Yes, at both the Service and DAO level. It's in the code I posted! :)

On 15 December 2010 20:15, James Carman [via Apache Wicket] <
ml-node+3089806-1760738882-201...@n4.nabble.com<ml-node%2b3089806-1760738882-201...@n4.nabble.com>
> wrote:

> You also need to make sure you've set up your transactions properly.
> Are you using the @Transactional annotations?
>
> On Wed, Dec 15, 2010 at 11:40 AM, adam.gibbons <[hidden 
> email]<http://user/SendEmail.jtp?type=node&node=3089806&i=0>>
> wrote:
>
> >
> > Hi Hielke,
> >
> > Thank you for the helpful reply. :) But I think I already have those in
> my
> > applicationConext.xml...:
> >
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <beans
> >    xmlns="http://www.springframework.org/schema/beans";
> >    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> >    xmlns:aop="http://www.springframework.org/schema/aop";
> >    xmlns:tx="http://www.springframework.org/schema/tx";
> >    xmlns:context="http://www.springframework.org/schema/context";
> >    xsi:schemaLocation="
> >        http://www.springframework.org/schema/beans
> > http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> >        http://www.springframework.org/schema/aop
> > http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
> >        http://www.springframework.org/schema/tx
> > http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
> >        http://www.springframework.org/schema/context
> > http://www.springframework.org/schema/context/spring-context-2.5.xsd
> >    "
> >    default-autowire="byType"
> >    default-lazy-init="false"
> >>
> >    <bean id="wicketApplication"
> > class="uk.co.company.product.presentation.wicket.app.WicketApplication"
> />
> >
> >    <bean id="placeholderConfigurer"
> >
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
>
> > autowire="byName">
> >        <property name="ignoreUnresolvablePlaceholders" value="false" />
> >        <property name="systemPropertiesModeName"
> > value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
> >        <property name="ignoreResourceNotFound" value="false" />
> >        <property name="locations"><list>
> >            <value>classpath*:/application.properties</value>
> >        </list></property>
> >    </bean>
> >
> >    <bean id="dataSource"
> > class="org.springframework.jdbc.datasource.DriverManagerDataSource"
> > autowire="byName">
> >        <property
> > name="driverClassName"><value>${jdbc.driver}</value></property>
> >        <property name="url"><value>${jdbc.url}</value></property>
> >        <property
> name="username"><value>${jdbc.username}</value></property>
> >        <property
> name="password"><value>${jdbc.password}</value></property>
> >    </bean>
> >
> >    <tx:annotation-driven transaction-manager="txManager" />
> >
> >    <bean id="txManager"
> > class="org.springframework.orm.hibernate3.HibernateTransactionManager"
> > autowire="byName">
> >        <property name="sessionFactory" ref="sessionFactory" />
> >    </bean>
> >
> >    <!--<bean id="interceptor"
> > class="com.mycompany.hibernate.HibernateInterceptor">
> >    </bean>-->
> >
> >    <bean id="sessionFactory"
> >
> class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"
>
> > autowire="byName">
> >        <property name="dataSource" ref="dataSource" />
> >        <property name="hibernateProperties">
> >            <props>
> >                <!-- GENERAL -->
> >                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
> >                <prop key="hibernate.show_sql">true</prop>
> >                <prop key="hibernate.show_sql">hibernate.format_sql</prop>
>
> >                <prop key="hibernate.default_schema">zen_template</prop>
> >                <prop key="hibernate.max_fetch_depth">2</prop>
> >                <!-- <prop
> > key="hibernate.default_batch_fetch_size">16</prop> -->
> >                <prop key="hibernate.default_entity_mode">pojo</prop>
> >                <prop key="hibernate.order_updates">true</prop>
> >                <prop key="hibernate.generate_statistics">true</prop>
> >                <prop key="hibernate.use_identifier_rollback">true</prop>
> >                <prop
> > key="hibernate.current_session_context_class">thread</prop>
> >                <prop key="hibernate.use_outer_join">true</prop>
> >                <!-- JDBC -->
> >                <!-- <prop key="hibernate.jdbc.batch_size">20</prop> -->
> >                <!-- <prop
> > key="hibernate.jdbc.batch_versioned_data">true</prop> -->
> >                <prop
> > key="hibernate.jdbc.use_streams_for_binary">true</prop>
> >                <prop
> > key="hibernate.jdbc.use_get_generated_keys">true</prop>
> >                <!-- CONNECTION -->
> >                <prop key="hibernate.connection.isolation">8</prop><!--
> > TRANSACTION_SERIALIZABLE -->
> >                <prop key="hibernate.connection.autocommit">false</prop>
> >                <prop key="hibernate.connection.pool_size">5</prop>
> >                <!-- CACHE -->
> >                <!-- <prop
> >
> key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
>
> > -->
> >                <!-- <prop
> > key="hibernate.cache.use_minimal_puts">true</prop> -->
> >                <!-- <prop
> key="hibernate.cache.use_query_cache">true</prop>
> > -->
> >                 <!-- MISCELLANEOUS -->
> >                 <prop
> > key="hibernate.bytecode.use_reflection_optimizer">true</prop>
> >                <prop
> > key="hibernate.cglib.use_reflection_optimizer">true</prop>
> >                <!-- <prop key="hibernate.bytecode.provider">cglib</prop>
> > -->
> >                <!-- <prop key="hibernate.query.substitutions">true</prop>
>
> > -->
> >            </props>
> >        </property>
> >        <!--<property name="entityInterceptor">
> >            <ref bean="interceptor" />
> >        </property>-->
> >        <property name="packagesToScan"><list>
> >            <value>uk.co.company.product.persistance.hibernate</value>
> >        </list></property>
> >    </bean>
> >     <context:component-scan base-package="uk.co.company.product" />
> >     <context:annotation-config/>
> > </beans>
> >
> >
> >
> >
> > On 15 December 2010 16:17, Hielke Hoeve [via Apache Wicket] <
> > [hidden email] 
> > <http://user/SendEmail.jtp?type=node&node=3089806&i=1><[hidden
> email] <http://user/SendEmail.jtp?type=node&node=3089806&i=2>>
> >> wrote:
> >
> >> Hey Adam,
> >>
> >> This is still a spring error, you need a sessionfactory and
> >> transactionfactory and link them together. The opensessioninview filter
> >> only
> >> opens a transaction if you get this right. The spring forums are filled
> >> with
> >> examples.
> >>
> >> Hielke
> >> On 15 Dec 2010 16:58, "adam.gibbons" <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=3089324&i=0>>
> >> wrote:
> >>
> >> >
> >> >
> >> > Ok, I think this is now back to a Wicket question. Start up is ok now.
>
> >> > However when I try and invoke UserServiceImpl.authenticate(){
> >> >        final Temp1 temp1 = new Temp1();
> >> >        temp1.setValue(userName);
> >> >        temp1DAO.save(temp1);
> >> >        return testUserService.authenticate(userName, password);
> >> > }
> >> >
> >> > I get the following error through the GUI:
> >> >
> >> > Method onFormSubmitted of interface
> >> > org.apache.wicket.markup.html.form.IFormSubmitListener targeted at
> >> component
> >> > [MarkupContainer [Component id = signInForm]] threw an exception
> >> >
> >> > Root cause:
> >> >
> >> > org.hibernate.HibernateException: persist is not valid without active
> >> > transaction
> >> > at
> >> >
> >>
> org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:297)
>
> >>
> >> > at $Proxy18.persist(Unknown Source)
> >> > at
> >> >
> >>
> uk.co.company.product.persistance.hibernate.AbstractTemp1DAO.save(AbstractTemp1DAO.java:21)
>
> >>
> >> > at
> >> >
> >>
> uk.co.company.product.persistance.hibernate.Temp1DAOImpl.save(Temp1DAOImpl.java:1)
>
> >>
> >> > at java.lang.reflect.Method.invoke(Method.java:597)
> >> > at
> >> >
> >>
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
>
> >>
> >> > at
> >> >
> >>
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
>
> >>
> >> > at
> >> >
> >>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
>
> >>
> >> > at
> >> >
> >>
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
>
> >>
> >> > at
> >> >
> >>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>
> >>
> >> > at
> >> >
> >>
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>
> >>
> >> > at $Proxy9.save(Unknown Source)
> >> > at
> >> >
> >>
> uk.co.company.product.business.spring.UserServiceImpl.authenticate(UserServiceImpl.java:42)
>
> >>
> >> > at java.lang.reflect.Method.invoke(Method.java:597)
> >> > at
> >> >
> >>
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
>
> >>
> >> > at
> >> >
> >>
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
>
> >>
> >> > at
> >> >
> >>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
>
> >>
> >> > at
> >> >
> >>
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
>
> >>
> >> > at
> >> >
> >>
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>
> >>
> >> > at
> >> >
> >>
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>
> >>
> >> > at $Proxy10.authenticate(Unknown Source)
> >> > at java.lang.reflect.Method.invoke(Method.java:597)
> >> > at
> >> >
> >>
> org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:416)
>
> >>
> >> > at org.apache.wicket.proxy.$Proxy15.authenticate(Unknown Source)
> >> > at
> >> >
> >>
> uk.co.company.product.presentation.wicket.app.CustomAuthenticatedWebSession.authenticate(CustomAuthenticatedWebSession.java:29)
>
> >>
> >> >
> >> > I was under the impression that the OpenSessionInViewFilter was
> supposed
> >> to
> >>
> >> > do this for us?
> >> >
> >> >
> >> > Once again here is the source code:
> >> >
> >> >
> >> > web.xml:
> >> >
> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> > <web-app
> >> >    xmlns="http://java.sun.com/xml/ns/j2ee";
> >> >    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> >> >    xsi:schemaLocation="
> >> >        http://java.sun.com/xml/ns/j2ee
> >> >        http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
> >> >    "
> >> >    version="2.4"
> >> > >
> >> >    <display-name>ZenTemplate</display-name>
> >> >    <context-param>
> >> >        <param-name>contextConfigLocation</param-name>
> >> >        <param-value>classpath:applicationContext.xml</param-value>
> >> >    </context-param>
> >> >    <listener>
> >> >
> >> >
> >>
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>
> >>
> >> >    </listener>
> >> >    <filter>
> >> >        <filter-name>opensessioninview</filter-name>
> >> >
> >> >
> >>
> <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
>
> >>
> >> >    </filter>
> >> >    <filter>
> >> >        <filter-name>wicket-spring-hibernate</filter-name>
> >> >
> >> >
> <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
> >>
> >> >        <init-param>
> >> >            <param-name>applicationFactoryClassName</param-name>
> >> >
> >> >
> >>
> <param-value>org.apache.wicket.spring.SpringWebApplicationFactory</param-value>
>
> >>
> >> >        </init-param>
> >> >        <init-param>
> >> >            <param-name>applicationClassName</param-name>
> >> >
> >> >
> >>
> <param-value>uk.co.company.product.presentation.wicket.app.WicketApplication</param-value>
>
> >>
> >>
> >> >        </init-param>
> >> >    </filter>
> >> >    <filter-mapping>
> >> >        <filter-name>opensessioninview</filter-name>
> >> >        <url-pattern>/*</url-pattern>
> >> >    </filter-mapping>
> >> >    <filter-mapping>
> >> >        <filter-name>wicket-spring-hibernate</filter-name>
> >> >        <url-pattern>/*</url-pattern>
> >> >    </filter-mapping>
> >> > </web-app>
> >> >
> >> >
> >> >
> >> > applicationContext.xml:
> >> >
> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> > <beans
> >> >    xmlns="http://www.springframework.org/schema/beans";
> >> >    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> >> >    xmlns:aop="http://www.springframework.org/schema/aop";
> >> >    xmlns:tx="http://www.springframework.org/schema/tx";
> >> >    xmlns:context="http://www.springframework.org/schema/context";
> >> >    xsi:schemaLocation="
> >> >        http://www.springframework.org/schema/beans
> >> > http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> >> >        http://www.springframework.org/schema/aop
> >> > http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
> >> >        http://www.springframework.org/schema/tx
> >> > http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
> >> >        http://www.springframework.org/schema/context
> >> > http://www.springframework.org/schema/context/spring-context-2.5.xsd
> >> >    "
> >> >    default-autowire="byType"
> >> >    default-lazy-init="false"
> >> > >
> >> >    <bean id="wicketApplication"
> >> >
> class="uk.co.company.product.presentation.wicket.app.WicketApplication"
> >> />
> >> >
> >> >    <bean id="placeholderConfigurer"
> >> >
> >>
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
>
> >>
> >>
> >> > autowire="byName">
> >> >        <property name="ignoreUnresolvablePlaceholders" value="false"
> />
> >> >        <property name="systemPropertiesModeName"
> >> > value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
> >> >        <property name="ignoreResourceNotFound" value="false" />
> >> >        <property name="locations"><list>
> >> >            <value>classpath*:/application.properties</value>
> >> >        </list></property>
> >> >    </bean>
> >> >
> >> >    <bean id="dataSource"
> >> > class="org.springframework.jdbc.datasource.DriverManagerDataSource"
> >> > autowire="byName">
> >> >        <property
> >> > name="driverClassName"><value>${jdbc.driver}</value></property>
> >> >        <property name="url"><value>${jdbc.url}</value></property>
> >> >        <property
> >> name="username"><value>${jdbc.username}</value></property>
> >> >        <property
> >> name="password"><value>${jdbc.password}</value></property>
> >>
> >> >    </bean>
> >> >
> >> >    <tx:annotation-driven transaction-manager="txManager" />
> >> >
> >> >    <bean id="txManager"
> >> > class="org.springframework.orm.hibernate3.HibernateTransactionManager"
>
> >> > autowire="byName">
> >> >        <property name="sessionFactory" ref="sessionFactory" />
> >> >    </bean>
> >> >
> >> >    <!--<bean id="interceptor"
> >> > class="com.mycompany.hibernate.HibernateInterceptor">
> >> >    </bean>-->
> >> >
> >> >    <bean id="sessionFactory"
> >> >
> >>
> class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"
>
> >>
> >>
> >> > autowire="byName">
> >> >        <property name="dataSource" ref="dataSource" />
> >> >        <property name="hibernateProperties">
> >> >            <props>
> >> >                <!-- GENERAL -->
> >> >                <prop
> key="hibernate.dialect">${hibernate.dialect}</prop>
> >> >                <prop key="hibernate.show_sql">true</prop>
> >> >                <prop
> key="hibernate.show_sql">hibernate.format_sql</prop>
> >>
> >> >                <prop
> key="hibernate.default_schema">zen_template</prop>
> >> >                <prop key="hibernate.max_fetch_depth">2</prop>
> >> >                <!-- <prop
> >> > key="hibernate.default_batch_fetch_size">16</prop> -->
> >> >                <prop key="hibernate.default_entity_mode">pojo</prop>
> >> >                <prop key="hibernate.order_updates">true</prop>
> >> >                <prop key="hibernate.generate_statistics">true</prop>
> >> >                <prop
> key="hibernate.use_identifier_rollback">true</prop>
> >> >                <prop
> >> > key="hibernate.current_session_context_class">thread</prop>
> >> >                <prop key="hibernate.use_outer_join">true</prop>
> >> >                <!-- JDBC -->
> >> >                <!-- <prop key="hibernate.jdbc.batch_size">20</prop>
> -->
> >> >                <!-- <prop
> >> > key="hibernate.jdbc.batch_versioned_data">true</prop> -->
> >> >                <prop
> >> > key="hibernate.jdbc.use_streams_for_binary">true</prop>
> >> >                <prop
> >> > key="hibernate.j
> >>
> >>
> >> ------------------------------
> >>  View message @
> >>
> http://apache-wicket.1842946.n4.nabble.com/help-me-please-Wicket-Spring-Hibernate-configuration-woes-tp3088768p3089324.html<http://apache-wicket.1842946.n4.nabble.com/help-me-please-Wicket-Spring-Hibernate-configuration-woes-tp3088768p3089324.html?by-user=t>
> >>
> >> To start a new topic under Apache Wicket, email
> >> [hidden email] 
> >> <http://user/SendEmail.jtp?type=node&node=3089806&i=3><[hidden
> email] <http://user/SendEmail.jtp?type=node&node=3089806&i=4>>
> >> To unsubscribe from Apache Wicket, click here<
> http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1842946&code=YWRhbS5zLmdpYmJvbnNAZ21haWwuY29tfDE4NDI5NDZ8LTUzNzMyMDU4OQ==<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1842946&code=YWRhbS5zLmdpYmJvbnNAZ21haWwuY29tfDE4NDI5NDZ8LTUzNzMyMDU4OQ==&by-user=t>>.
>
> >>
> >>
> >
> > --
> > View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/help-me-please-Wicket-Spring-Hibernate-configuration-woes-tp3088768p3089377.html<http://apache-wicket.1842946.n4.nabble.com/help-me-please-Wicket-Spring-Hibernate-configuration-woes-tp3088768p3089377.html?by-user=t>
>
> > Sent from the Users forum mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden 
> > email]<http://user/SendEmail.jtp?type=node&node=3089806&i=5>
> > For additional commands, e-mail: [hidden 
> > email]<http://user/SendEmail.jtp?type=node&node=3089806&i=6>
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden 
> email]<http://user/SendEmail.jtp?type=node&node=3089806&i=7>
> For additional commands, e-mail: [hidden 
> email]<http://user/SendEmail.jtp?type=node&node=3089806&i=8>
>
>
>
> ------------------------------
>  View message @
> http://apache-wicket.1842946.n4.nabble.com/help-me-please-Wicket-Spring-Hibernate-configuration-woes-tp3088768p3089806.html
>
> To start a new topic under Apache Wicket, email
> ml-node+1842946-1499480286-201...@n4.nabble.com<ml-node%2b1842946-1499480286-201...@n4.nabble.com>
> To unsubscribe from Apache Wicket, click 
> here<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1842946&code=YWRhbS5zLmdpYmJvbnNAZ21haWwuY29tfDE4NDI5NDZ8LTUzNzMyMDU4OQ==>.
>
>

-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/help-me-please-Wicket-Spring-Hibernate-configuration-woes-tp3088768p3090581.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to