Announcement Announcement Module
No announcement yet.
@Transactional on parent class not recognized: not good at all Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • @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?


  • #2
    Were you able to get a solution for the second issue - session propogationi.e.,how to stop session from getting closed in every call


    • #3
      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.