Results 1 to 3 of 3

Thread: Class Hierarchy problem using Transactional

  1. #1
    Join Date
    Aug 2010
    Posts
    2

    Default Class Hierarchy problem using Transactional

    Project setup: Spring 3.0.5 / JPA 2 / Hibernate / @Transactional

    We work with several different Data Sources (and hence different transaction managers), but have common Service base classes, as a lot of the functionality is reused.

    So we thought we'd solve this by using Custom Annotations. We define all methods in an abstract base class, and create one empty implementation class per TransactionManager.

    Now the problem is:

    In AbstractFallbackTransactionAttributeSource, this is the lookup that is being done:

    Code:
    TransactionAttribute txAtt = findTransactionAttribute(specificMethod);
    // ...
    // Second try is the transaction attribute on the target class.
    txAtt = findTransactionAttribute(specificMethod.getDeclaringClass());
    First the method is checked, then the class that declares the method (and its ancestors). But in our context, the custom annotation resides in a subclass that can't be found by going upwards.

    So how can we solve this problem?

    Thanks in advance, Sean Floyd

  2. #2
    Join Date
    Apr 2011
    Posts
    107

    Default

    Perhaps you could check 'AbstractRoutingDataSource' ?

  3. #3
    Join Date
    Aug 2010
    Posts
    2

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •