Hello,
i have a web app with hibernate 4 integration.
This is my simple configuration:
I'm using @Transactional annotation to let the framework manages the transaction, however in a particular service I really need to force the commit after an insertion, if something after this fails i can not accept the rollback of transaction.
I would like if there is a way to control transaction inside a @Transactional method.
I also thought to remove @Transactional annotation from method but this way all components of the service fails on lazy loads of entities.
What do you suggest?
i have a web app with hibernate 4 integration.
This is my simple configuration:
Code:
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost/dbtest" />
<property name="username" value="dbtest" />
<property name="password" value="dbtest" />
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan">
<list>
<value>com.test.db.entity</value>
</list>
</property>
<property name="mappingResources">
<list>
<value>com/test/db/entity/queries.hbm.xml</value>
</list>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
I'm using @Transactional annotation to let the framework manages the transaction, however in a particular service I really need to force the commit after an insertion, if something after this fails i can not accept the rollback of transaction.
I would like if there is a way to control transaction inside a @Transactional method.
I also thought to remove @Transactional annotation from method but this way all components of the service fails on lazy loads of entities.
What do you suggest?