[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=16306857#comment-16306857 ] John D. Ament commented on DELTASPIKE-940: -- Yep, simply forgot to upate JIRA! > @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: John D. Ament >Priority: Minor > Fix For: 1.8.1 > > Attachments: ds940.patch > > > 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.4.14#64029)
[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=16274489#comment-16274489 ] ASF subversion and git services commented on DELTASPIKE-940: Commit 51eceaec9ccd7993bda8ebb7f92a4ef19417733a in deltaspike's branch refs/heads/master from [~johndament] [ https://git-wip-us.apache.org/repos/asf?p=deltaspike.git;h=51eceae ] DELTASPIKE-940 - Fixed missing third case of default resolution. Ensure that the entity manager is resolved. > @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: John D. Ament >Priority: Minor > Fix For: 1.8.1 > > Attachments: ds940.patch > > > 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.4.14#64029)
[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=16274449#comment-16274449 ] John D. Ament commented on DELTASPIKE-940: -- got it. The issue looks pretty straight forward, should be a simple fix. > @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: John D. Ament >Priority: Minor > Fix For: 1.8.1 > > Attachments: ds940.patch > > > 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.4.14#64029)
[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=16124726#comment-16124726 ] John D. Ament commented on DELTASPIKE-940: -- [~tandraschko] sorry thought I had already responded. The problem with pulling it out is that it has to be in two places, since this annotation can control both transactions and repository. Having it in a common place makes more sense. > @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: John D. Ament >Priority: Minor > Fix For: 1.8.1 > > Attachments: ds940.patch > > > 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.4.14#64029)
[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=16124650#comment-16124650 ] ASF subversion and git services commented on DELTASPIKE-940: Commit 28bcefc88dc38c27ad6acfe28a46f1810af81c56 in deltaspike's branch refs/heads/master from [~johndament] [ https://git-wip-us.apache.org/repos/asf?p=deltaspike.git;h=28bcefc ] DELTASPIKE-940 - Avoid reading transactional annotation. > @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: John D. Ament >Priority: Minor > Fix For: 1.8.1 > > Attachments: ds940.patch > > > 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.4.14#64029)
[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=16013081#comment-16013081 ] Mark Struberg commented on DELTASPIKE-940: -- --- deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/api/transaction/Transactional.java (revision 0cdede08c07b0ed791b9018e1ea5281b690728ae) +++ deltaspike/modules/jpa/api/src/main/java/org/apache/deltaspike/jpa/api/transaction/Transactional.java (revision ) @@ -58,8 +58,12 @@ * {@link javax.persistence.EntityManager}s with qualifiers in a called method (of a different bean) * which isn't {@link Transactional} itself. * + * This method is now deprecated, and if you have multiple {@link javax.persistence.EntityManager}s you should use + * {@link org.apache.deltaspike.jpa.api.entitymanager.EntityManagerResolver} + * * @return target persistence-unit identifier */ +@Deprecated @Nonbinding Class[] qualifier() default Any.class; as explained, the qualifier makes sense and is used by various projects. > @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: John D. Ament >Priority: Minor > Fix For: 1.8.1 > > Attachments: ds940.patch > > > 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.15#6346)
[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=16012187#comment-16012187 ] Mark Struberg commented on DELTASPIKE-940: -- +1 for moving this cleanup to 2.0 if any. As Gerhard already explained: the Qualifier in @Transactional is to support multiple different Databases where we then do a 'cheap man XA'. Means we will first iterate over all open EntityManagers and invoke #flush() on them and only if that works for all connections we do a em.commit() on all. This is not really XA, but in practice you blow up during the flush() in 98%of all cases. > @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: John D. Ament >Priority: Minor > Fix For: 2.0 > > > 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.15#6346)
[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=16002558#comment-16002558 ] John D. Ament commented on DELTASPIKE-940: -- While we shouldn't remove the old behavior pre-DS 2.0, it would be good to provide similar capabilities in both. As a result, I think it makes sense to include qualifier in the look up while still allowing class based resolution. > @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: John D. Ament >Priority: Minor > Fix For: 1.8.0 > > > 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.15#6346)
[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=15112287#comment-15112287 ] Gerhard Petracek commented on DELTASPIKE-940: - [~thomashug]: imo we shouldn't change it (at least until v2) > @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)
[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=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)
[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=15112328#comment-15112328 ] Thomas Hug commented on DELTASPIKE-940: --- Agree, v2 might be a good opportunity to consolidate the API. > @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)
RE: [jira] [Commented] (DELTASPIKE-940) @Transactional and @EntityManagerConfig each use a different method to resolve EntityManagers
At the risk of demonstrating a lack of adequate context to contribute to the discussion... One preference expressed at our shop is to eliminate the notion of "defaulting" to an EntityManager. That is, pursue an API that provides explicit readability as to which EntityManager/persistenceUnitName is being invoked. In addition, the API should enable multiple alternative EntityManagers during JUnit testing. Here is the type of testing use case typical in a large shop: 1. A standard JUnit tests uses H2 as an embedded database. 2. A 'special case' Stored Procedure test uses the application SQL Server database (DEV instance). 3. A 'special case' View test accesses a legacy DB2 database. In this scenario items #1 and #2 require at least one alternatve and #3 requires a unique persitenceUnitName. And of course there are additional scenarios where more than one alternative is required. So perhaps for some, the idea of an API providing "magic" defaulting is less attractive than explicit in-line readability. _Marvin -Original Message- From: Thomas Hug (JIRA) [mailto:j...@apache.org] Sent: Friday, January 22, 2016 6:50 AM To: deltaspike-...@incubator.apache.org Subject: [jira] [Commented] (DELTASPIKE-940) @Transactional and @EntityManagerConfig each use a different method to resolve EntityManagers > When an application uses multiple {{EntityManager}}'s, there must be a way to > specify which one(s) should be used
[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=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)
[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=15110810#comment-15110810 ] Thomas Hug commented on DELTASPIKE-940: --- The main reason to use a resolver approach in the Data module was that there is a similar approach in the JSF module (MessageResolver AFAIR) so to stick to this also in the JPA module would be overall consistent. Another disadvantage of {{@Transactional(qualifier = ...}} is that a qualifier is limited to an annotation type. A "proper" qualifier could also include arguments, e.g. {{@MyDB(DbSchema.CUSTOMER)}} which wouldn't work with this approach. Anything speaking against moving {{EntityManagerResolver}} into the JPA module? > @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)
[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=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)