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@lists.jboss.org <cdi-dev-bounces@lists.jboss.org> on behalf of Donatas <donatas.ciuksys@gmail.com>
Sent: Friday, March 10, 2017 9:05 AM
To: cdi-dev@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@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.