Cloves J. G. Almeida created DELTASPIKE-508:
-----------------------------------------------
Summary: @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
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
(v6.1.5#6160)