Uploaded image for project: 'DeltaSpike'
  1. DeltaSpike
  2. DELTASPIKE-508

@Transaction return NPE on qualified Datasource injections

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.5
    • None
    • JPA-Module
    • None
    • Linux, JBoss-EAP-6.2, Java 7

    Description

      When using JTA transactions (and probably Resouce Local), a bean injecting a qualified DataSource without an EntityManager also being injected will fail with an NPE if there's no default EntityManager or won't put the correct datasource into the transaction (and fail or act inconsistently).

      The reason is that in org.apache.deltaspike.jpa.impl.transaction.TransactionStrategyHelper.resolveEntityManagerQualifiers only injected EntityManagers are scanned for qualifiers used to resolve.

      A workaround is to place a qualified EntityManager pointing to the same datasource. This is limited, however. Some use cases, like batch processing does not require an EntityManager and one might not be available.

      Attachments

        Issue Links

          Activity

            People

              struberg Mark Struberg
              cjalmeida Cloves J. G. Almeida
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: