Hello,
I am using spring 2.5.6, hibernate 3.3 and tomcat 6, MySQL 5. Below is my application.xml showing database config. The problem I have is that changes that I have made to hibernate objects attached to the hibernate session only get committed to the database provided I call session.flush() or an explicit hibernate save/update method at the end of the transaction. How can I set things up so that the the changes are committed without having to do either of these approaches. I have lots of methods and it would be a real pain to have to do explicit save calls or a session.flush() at the end of each transaction method. Below is the relevant part of my applicationContext.xml.
Many thanks. Help would be REALLY appreciated
<context:annotation-config/>
<bean id="myDataSource" class="org.springframework.jndi.JndiObjectFactoryB ean">
<property name="jndiName" value="java:comp/env/jdbc/filmSource"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
<property name="dataSource" ref="myDataSource"/>
<property name="mappingResources">
<list>
<value>film/hibernate/Commission.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQ LDialect</prop>
<prop key="hibernate.cache.provider_class">org.hibernate .cache.EhCacheProvider</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<aop:config>
<aopointcut id="defaultServiceOperation"
expression="execution(* *Helper.*(..))"/>
<aop:advisor pointcut-ref="defaultServiceOperation" advice-ref="defaultTxAdvice"/>
</aop:config>
<tx:advice id="defaultTxAdvice">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED" isolation="READ_COMMITTED" />
</tx:attributes>
</tx:advice>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>


ointcut id="defaultServiceOperation"
Reply With Quote
