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

Thomas Hug commented on DELTASPIKE-940:
---------------------------------------

So by using {{@Transactional(qualifier = ...)}} the point of each qualifier 
added here is to select exactly one {{EntityManager}} instead of all available 
over @Any. Same thing {{EntityManagerResolver}} is used in the Data module for 
(but as you mentioned we have a different concept of 1 EM per repository, so 
the limiting factor is {{@EntityManagerConfig}} on type level).

I don't have a preference for one or the other, the original CDI Query was 
acutally using qualifiers to select the EM for each repository in case multiple 
existed. As mentioned above the major reason for {{EntityManagerResolver}} was 
a consistent approach with the JSF module. Changing one or the other will break 
existing code so not really sure whether something should be changed at all 
(given we have slightly different concepts). Other preferences?

> @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