Hi! I'm currently implementing (at least I try) resource injection into fields.
So I extend DefinitionUtil#defineInjectedFields(ComponentImpl<T> component) to also handle resources: Annotation[] bindingAnns = AnnotationUtil.getBindingAnnotations(anns); Annotation[] resourceAnns = AnnotationUtil.getResourceAnnotations(anns); (AnnotationUtil.getResourceAnnotations is new code) And now the question: May bindings and resources exist at the same time? I think the spec doesn't allow it, wdyt? So this example is imho invalid: @Searchengine @PersistenceContext private EntityManager entityManager; instead this has to be set via @PersistenceContex(unitName="searchengine") or something But resources maybe can be defined with different deployment types in XML? So having one db for Mock and one for Production would be handy. Or don't we care about this yet? LieGrue, strub --- Gurkan Erdogdu <[email protected]> schrieb am Mo, 26.1.2009: > Von: Gurkan Erdogdu <[email protected]> > Betreff: Re: AW: Basic understanding of JPA EntityManager injection > An: [email protected] > Datum: Montag, 26. Januar 2009, 22:50 > I did not look at in Resources section 3.6 in detail. But I > think it adds BindingTypes to the Java EE resources. > > Specification does not redefine the Java EE resource > injections, concepts are the same. Just add another > injection model with using BindingTypes. > > /Gurkan > > > > > ________________________________ > From: Mark Struberg <[email protected]> > To: [email protected] > Sent: Monday, January 26, 2009 10:44:43 PM > Subject: Re: AW: Basic understanding of JPA EntityManager > injection > > Programming question: > > Should we treat PersistenceContext, PersistenceUnit as kind > of a BindingType? > I'm not sure about this. WDYT? > > LieGrü, > strub > > > --- Gurkan Erdogdu <[email protected]> schrieb > am Mo, 26.1.2009: > > > Von: Gurkan Erdogdu <[email protected]> > > Betreff: Re: AW: Basic understanding of JPA > EntityManager injection > > An: [email protected] > > Datum: Montag, 26. Januar 2009, 20:32 > > You are right Mark. If EJB container is in the > scenario, EJB > > container is responsible for handling these. If not, > then > > the OWB will inject these. > > > > There is also new resource injection defined in > chapter 3.6 > > > > /Gurkan > > > > > > > > > > ________________________________ > > From: Mark Struberg <[email protected]> > > To: [email protected] > > Sent: Monday, January 26, 2009 7:11:31 PM > > Subject: AW: Basic understanding of JPA EntityManager > > injection > > > > Humm, maybe I thought to complex about this the first > time > > and there are no interferences between > PersistenceUnits in > > EJB managed beans and PersistenceUnits in WebBeans at > all? > > > > If there aren't any, then we could simply reduce > the > > logic to > > > > any @PersistenceContext,... in EJB will be injected by > the > > EJB container > > any @PersistenceContext,... in WebBeans will be > injected by > > OWB. > > > > since > > > Persistence.createEntityManagerFactory("unitname") > > will in both cases return the same instance (hopefully > also > > in more complex JNDI setups!) > > > > Any error in my reasoning? > > > > LieGrue, > > strub > > > > --- Mark Struberg <[email protected]> schrieb am > Mo, > > 26.1.2009: > > > > > Von: Mark Struberg <[email protected]> > > > Betreff: AW: Basic understanding of JPA > EntityManager > > injection > > > An: [email protected] > > > Datum: Montag, 26. Januar 2009, 14:22 > > > to be more specific: this is about how to > implement > > the > > > section > > > > > > 3.10. Support for Common Annotations > > > > > > of the spec. My fear is that the EJB container > and > > > OpenWebBeans interfere with each other in this > domain. > > > > > > There is currently only the handling of > @PostConstruct > > and > > > @PreDestroy implemented for beans under our > control. > > > > > > LieGrue, > > > strub > > > > > > > > > --- Mark Struberg <[email protected]> > schrieb am > > Mo, > > > 26.1.2009: > > > > > > > Von: Mark Struberg <[email protected]> > > > > Betreff: Basic understanding of JPA > EntityManager > > > injection > > > > An: [email protected] > > > > Datum: Montag, 26. Januar 2009, 12:56 > > > > Hi! > > > > > > > > A little question about integrating handlers > for > > a few > > > very > > > > specific situations: > > > > > > > > If we provide support for JPA, then the > following > > > > annotations are often being used: > > > > > > > > javax.persistence.PersistenceContext > > > > javax.persistence.PersistenceContexts > > > > javax.persistence.PersistenceUnit > > > > javax.persistence.PersistenceUnits > > > > > > > > They are really very handy, even if NO EJB > > container > > > is > > > > involved. > > > > > > > > So my question is: do we like to support > this > > > functionality > > > > in a standalone manner? > > > > > > > > In other words: > > > > if (!EJBContainer available) { > > > > inject PersistenceContext and > PersistenceUnit > > > > } > > > > > > > > This is the way Spring works, and I > personally > > find > > > this > > > > quite handy. > > > > > > > > We could easily implement this in an own > optional > > > module. > > > > > > > > WDYT? > > > > > > > > LieGrue, > > > > strub
