I am using Spring 3, JPA + Hibernate for a CMS application. In that application I have a service class method which is annotated with @Transactional Annotation with rollBack property. Inside that method I am inserting data (ie entity classes) to a table using a loop. For each iteration of the loop entity classes has to be saved to the database. But it is not happening. The commit only happens when the execution of the loop has completed and exits from the method. Then it commits and saves all at once. But I need to read data once it gets inserted into the database before committing in this case. I tried with the ISOLATION LEVEL to read uncommitted but it didn’t supported since I am using the default JPADialect. Also tried to add the hibernate implementation of jpaDialect but still it didn’t worked. Please help with a workaround for this problem. One more thing, is there any way using propagation required method.
I am using Spring 3, JPA + Hibernate for a CMS application. In that
Share
remove the transactional annoation on the the method with loop.
In the loop call a separate method to perform the save, make that method transactional