[cdi-dev] Review comment: consider allowing NormalScoped EntityManager producers

John Ament john.ament at spartasystems.com
Fri Mar 10 09:08:40 EST 2017


Donatas,


There's nothing stopping request scoped entity managers, from a spec level.  The spec is referring to the inject of resources via @Resource and similar annotations (e.g. PersistenceContext).


John




________________________________
From: cdi-dev-bounces at lists.jboss.org <cdi-dev-bounces at lists.jboss.org> on behalf of Donatas <donatas.ciuksys at gmail.com>
Sent: Friday, March 10, 2017 9:05 AM
To: cdi-dev at lists.jboss.org
Subject: [cdi-dev] Review comment: consider allowing NormalScoped EntityManager producers

Section "18.7. Resources" contains:

/The container is not required to support resources with scope other than
@Dependent. Portable applications should not define resources with any scope
other than @Dependent./

Yet the CDI spec itself has examples like the one in section "3.4.2.
Declaring a disposer method":

@Produces *@ConversationScoped* @UserDatabase
public *EntityManager* create(EntityManagerFactory emf) {
    return emf.createEntityManager();
}

Most best practices recommend @RequestScoped EntityManager producer (e.g.:
DeltaSpike JPA module:  http://deltaspike.apache.org/documentation/jpa.html
<http://deltaspike.apache.org/documentation/jpa.html>  ).

Thus please consider explicitly allowing NormalScoped EntityManager
producers.

Donatas



--
View this message in context: http://cdi-development-mailing-list.1064426.n5.nabble.com/Review-comment-consider-allowing-NormalScoped-EntityManager-producers-tp5714560.html
Sent from the CDI Development mailing list mailing list archive at Nabble.com.
_______________________________________________
cdi-dev mailing list
cdi-dev at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/cdi-dev

Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
________________________________
NOTICE: This e-mail message and any attachments may contain confidential, proprietary, and/or privileged information which should be treated accordingly. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this message, and destroy all physical and electronic copies. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20170310/a593b0e7/attachment-0001.html 


More information about the cdi-dev mailing list