[ 
https://issues.apache.org/jira/browse/DELTASPIKE-940?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15110905#comment-15110905
 ] 

Gerhard Petracek commented on DELTASPIKE-940:
---------------------------------------------

[~thomashug]:
that isn't the whole story. @Transactional#qualifier is not intended to be used 
for the main use-case. it's just in place for an optimization.
with @Transactional#qualifier you can limit the transactions to start.
without it all injected entity-managers will be used (for each entity-manager a 
transaction will get started).
for those entity-managers there is no qualifier limitation in theory (currently 
it's limited to qualifier-types to improve the performance, but it's just an 
implementation detail of EntityManagerEntry and not a limitation of the api).

it's the other way round: EntityManagerResolver is limited, because there can 
be only one active entity-manager.

> @Transactional and @EntityManagerConfig each use a different method to 
> resolve EntityManagers
> ---------------------------------------------------------------------------------------------
>
>                 Key: DELTASPIKE-940
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-940
>             Project: DeltaSpike
>          Issue Type: Improvement
>          Components: Data-Module, JPA-Module
>            Reporter: Xavier Dury
>            Assignee: Thomas Hug
>            Priority: Minor
>
> When an application uses multiple {{EntityManager}}'s, there must be a way to 
> specify which one(s) should be used. Currently, {{@Transactional}} and 
> {{@EntityManagerConfig}} use different approaches:
> - {{@Transactional}} can take one or more qualifiers directly in its 
> {{qualifier()}} member ({{@Transactional(qualifier = MyDB.class)}})
> - While {{@EntityManagerConfig}} must define an {{EntityManagerResolver}} 
> ({{@EntityManagerConfig(entityManagerResolver = 
> MyDBEntityManagerResolver.class}})
> I think both should be unified and use a single way to specify which 
> {{EntityManager}} to use. IMHO, the {{@Transactional}} way of doing looks 
> better and should be applied to {{@EntityManagerConfig}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to