You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by "Xavier Dury (JIRA)" <ji...@apache.org> on 2016/01/21 12:16:39 UTC

[jira] [Commented] (DELTASPIKE-940) @Transactional and @EntityManagerConfig each use a different method to resolve EntityManagers

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

Xavier Dury commented on DELTASPIKE-940:
----------------------------------------

Now I realize that there is an advantage using {{EntityManagerResolver}} instead of qualifiers: with qualifiers, you need to {{@Produces}} the entity manager which can cause trouble if it belongs to a passivation-capable scope (see {{SerializableEntityManager}}). The problem does not exist with {{EntityManagerResolver}} which does not produce anything but keeps the entity manager reference for on-demand resolving. So maybe, it is the {{@Transactional}} annotation which should have an {{entityManagerResolver}} attribute.

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