[ https://issues.apache.org/jira/browse/DELTASPIKE-508?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mark Struberg closed DELTASPIKE-508. ------------------------------------ Resolution: Fixed fixed a long time ago > @Transaction return NPE on qualified Datasource injections > ---------------------------------------------------------- > > Key: DELTASPIKE-508 > URL: https://issues.apache.org/jira/browse/DELTASPIKE-508 > Project: DeltaSpike > Issue Type: Bug > Components: JPA-Module > Affects Versions: 0.5 > Environment: Linux, JBoss-EAP-6.2, Java 7 > Reporter: Cloves J. G. Almeida > Assignee: Mark Struberg > Priority: Minor > > 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. -- This message was sent by Atlassian Jira (v8.3.4#803005)