I am using hibernate 3.3 with spring 3.0.5 and using JPA transaction manager. My scenario is a ui page invoking two get methods on service layer to render two regions in UI, Requests are parallel ajax requests. The get methods in service layer return two separate lists of same entity.
List<Car> getCarsA();
List<Car> getCarsB();
我配置了JPA交易经理如下:
<tx:method name="get*" read-only="true" propagation="REQUIRED"/>
Problem : when the hibernate/JPA calls flush after each service method is over, there is potentially some collection (via many-to-many mappings) which is shared between the two lists returned by the methods and hence the exception. I am also using OpenEntityManagerInViewFilter. I do not run into this error if I call the methods serially.