Apr 7th, 2009, 11:42 AM
@Transactional on parent class not recognized: not good at all
After struggling with a similar issue for several days, I've finally identified the culprit as exactly the same as discussed in this thread:
I don't like the way Spring implements it at all!
@Transactional annotation on abstract base classes should be picked up. Why not?
I have a design in which I put bulk of operations in a base service class. I then extend it to several concrete classes. However Spring does not recognize the @Transactional on my base service class!
Does anybody know whether this is fixed in Spring 3.0? Currently I'm using Spring 2.5.6.
Another issue is that Hibernate sessions get closed in each method annotated with @Transactional. Like this:
f1(); //which is also annotated with @Transactional and use getCurrentSession()
f2(); //which is also annotated with @Transactional and use getCurrentSession()
I expect the session created in f1() to propagate into f2() but it does not.
the session is closed in f1() and then a new session is created and closed in f2(), just like in f1().
Does Spring's SpringSessionContext implementation supports session propagation at all?
Apr 8th, 2009, 12:26 PM
Were you able to get a solution for the second issue - session propogationi.e.,how to stop session from getting closed in every call
Apr 15th, 2009, 06:41 PM
I'm having what I think is a related issue. I have marked one public method in my class as @Transactional. it is part of the interface. However, when I call it from another method in the same class, no transaction or session is created. Perhaps the compiler may optimize out the transactional proxy? If I call the method from another class, it is correctly proxied.