Announcement Announcement Module
Collapse
No announcement yet.
HELP: Force REQUIRED transaction propagation Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • HELP: Force REQUIRED transaction propagation

    Hi,

    I have a web service method which calls to many transactional methods of many DAO classes (annotated with Transactional(propagation = Propagation.REQUIRED_NEW)). I don't want these methods to create many new inner transactions and should use existing transaction instead. Is there any way to force reusing existing transaction without touching those DAO classes source code as I don't have access to the source code.

    I'm thinking of overriding Spring JpaTransactionManager class to do so but it has all critical methods made final or private which immutable to changing (e.g. getTransaction(), handleExistingTransaction(), ...) --> HELP!!!!!

    Thanks,
    Tai

  • #2
    Is there any way to force reusing existing transaction without touching those DAO classes source code as I don't have access to the source code.
    Why not Propagation.REQUIRED?

    If you dont have the source code or if you dont have the DAO source code...
    then you should work with XML...there you can apply transactions working with <aop....>

    Check the documentation for a better understanding

    Comment


    • #3
      Originally posted by dr_pompeii View Post
      Why not Propagation.REQUIRED?

      If you dont have the source code or if you dont have the DAO source code...
      then you should work with XML...there you can apply transactions working with <aop....>

      Check the documentation for a better understanding
      I was given a small app to maintain and they design as such an abstract generic DAO has REQUIRED_NEW annotation at class level and all DAO classes in application inherit from that. I don't know what the intention was but my sense it is not a good design.

      Thanks, I will try with your <aop> tags in XML, guess it will work.

      Comment


      • #4
        Hello

        I was given a small app to maintain and they design as such an abstract generic DAO has REQUIRED_NEW annotation at class level and all DAO classes in application inherit from that
        Dont forget that you can override the class level configuration declaring again in the method level....again read the documentation...

        Something like

        Code:
        @Transactional(propagation=Propagation.REQUIRES_NEW)
        public class X implements SomeInterface{
        
            @Transactional(propagation=Propagation.REQUIRED)
            public void something(){...}
        }

        Thanks, I will try with your <aop> tags in XML, guess it will work.
        You're welcome....

        Let me know your advance...

        Comment


        • #5
          Originally posted by dr_pompeii View Post
          Hello


          Dont forget that you can override the class level configuration declaring again in the method level....again read the documentation...

          Something like

          Code:
          @Transactional(propagation=Propagation.REQUIRES_NEW)
          public class X implements SomeInterface{
          
              @Transactional(propagation=Propagation.REQUIRED)
              public void something(){...}
          }
          You're welcome....

          Let me know your advance...
          Child DAO classes methods can call back to methods in the abstract generic DAO class and it opens new transaction there. As said, I don't have access to the parent generic DAO source code to change things there.

          Comment

          Working...
          X