Hi,
I’m having transaction issues migrating from spring 1.2.8 to 3.0.1 (with hibernate from 3.1.3 to 3.3.1)
Here’s the problem:
I have a java service (myService.java) with those parameters:
This service has 2 methods:Code:<property name="transactionAttributes"> <props> <prop key="process">PROPAGATION_REQUIRED, readOnly</prop> <prop key="save">PROPAGATION_REQUIRED, ISOLATION_READ_COMMITTED,-CefiException</prop> </props> </property>
The “process” method does stuffs without any writing in the database (readOnly)
The “save” method will save the result of “process” method into the database.
Here’s the code of process method:
This code was working fine with spring 1.2.8. When the “process” method is called, we also have the “save” method called and data saved in the database. Even if “process” is defined as “readOnly” method, because the service is reinstantiated (getBean…) so another transaction created and calling “save” won’t fail because “save” is not set to “readOnly”.Code:public void process(){ // some work … MyService service = (MyService) new ClassPathXmlApplicationContext( "classpath:/context.xml"). getBean( «myService»); // calling « save » method to save into database: service.save(processResult); }
With spring 3.0.1, there’s nothing saved in the database by the “save” method. The only way to have something saved is to remove the “readOnly” keyword on the “process” transaction configuration or moving the “save” method call out of “process” method.
Is there a way to have the previous behaviour with spring 3.0.1? Because I have a lot of services following this schema, so moving out the “save” method from “process” will take a lot of time and removing “readOnly” creates performances issues.


Reply With Quote
