You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Romain Manni-Bucau <rm...@gmail.com> on 2012/01/23 09:57:57 UTC

JPA 2.1?

Hi,

is there any work on JPA 2.1?

participating in the development of OpenEJB i'm particularly interested in
the entity  listener part which should be cdi beans now.

currently OpenEJB is using openjpa 2.1.1 and i didnt find any hook to
provide an instance of the entity listener.

is there already such a feature on trunk?

- Romain

Re: JPA 2.1?

Posted by Mark Struberg <st...@yahoo.de>.
Hi!

I would need to read the proposed JPA-2.1 wording in detail, but as far as I've understood it (we moved this from the CDI-EG over to the JPA-EG), JPA still maintains the entity listeners, but will resolve any injection points after creating the bean. The difference is subtle but very important. e.g. you cannot use interceptors in non-CDI managed beans. I can help with the integration efforts in both cases.


LieGrue,
strub



----- Original Message -----
> From: Romain Manni-Bucau <rm...@gmail.com>
> To: dev@openjpa.apache.org
> Cc: 
> Sent: Monday, January 23, 2012 8:06 PM
> Subject: Re: JPA 2.1?
> 
>T oday (and if i understood the code ;)) when i set an entity listener
> OpenJPA will do a new in the class.
> 
> what i would like is to be able to give the instance to OpenJPA. Like this
> the instance could be managed by CDI and i could inject anything inside it.
> 
> That's such a hook i'm looking for.
> 
> - Romain
> 
> 
> 2012/1/23 Kevin Sutter <kw...@gmail.com>
> 
>>  There has been no official development effort kicked off for JPA 2.1 yet.
>>   The numbering of OpenJPA releases is not in synch with the JPA
>>  specification levels.  OpenJPA's trunk development line is still based 
> off
>>  the JPA 2.0 specification.
>> 
>>  And, as far as Entity Listeners are concerned, we've had an 
> implementation
>>  [1] for these for quite some time.  Is there some new feature of these that
>>  are you looking for?
>> 
>>  Kevin
>> 
>>  [1]
>> 
>> 
> http://openjpa.apache.org/builds/latest/docs/manual/manual.html#jpa_overview_entity_listeners_using
>> 
>>  On Mon, Jan 23, 2012 at 2:57 AM, Romain Manni-Bucau
>>  <rm...@gmail.com>wrote:
>> 
>>  > Hi,
>>  >
>>  > is there any work on JPA 2.1?
>>  >
>>  > participating in the development of OpenEJB i'm particularly 
> interested
>>  in
>>  > the entity  listener part which should be cdi beans now.
>>  >
>>  > currently OpenEJB is using openjpa 2.1.1 and i didnt find any hook to
>>  > provide an instance of the entity listener.
>>  >
>>  > is there already such a feature on trunk?
>>  >
>>  > - Romain
>>  >
>> 
> 

Re: JPA 2.1?

Posted by Romain Manni-Bucau <rm...@gmail.com>.
thanks for the answer, the hook is interesting but doesn't seem to be
triggered:

trying it it still uses the clazz.newInstance() instead of the provided
instance.

Here the stack to see where it comes from (it is not an exception):

org.apache.openjpa.event.BeanLifecycleCallbacks.newListener(BeanLifecycleCallbacks.java:66)
at
org.apache.openjpa.event.BeanLifecycleCallbacks.<init>(BeanLifecycleCallbacks.java:61)
 at
org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parseCallbackMethods(AnnotationPersistenceMetaDataParser.java:980)
at
org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parseEntityListeners(AnnotationPersistenceMetaDataParser.java:911)
 at
org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parseClassAnnotations(AnnotationPersistenceMetaDataParser.java:584)
at
org.apache.openjpa.persistence.AnnotationPersistenceMetaDataParser.parse(AnnotationPersistenceMetaDataParser.java:415)
 at
org.apache.openjpa.persistence.PersistenceMetaDataFactory.load(PersistenceMetaDataFactory.java:260)
at
org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:580)
 at
org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java:400)
at
org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:384)
 at
org.apache.openjpa.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:355)
at org.apache.openjpa.jdbc.meta.MappingTool.getMapping(MappingTool.java:681)
 at
org.apache.openjpa.jdbc.meta.MappingTool.buildSchema(MappingTool.java:753)
at org.apache.openjpa.jdbc.meta.MappingTool.run(MappingTool.java:651)
 at
org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:154)
at
org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:164)
 at
org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFactory.java:122)
at
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:210)
 at
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
 at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)

any clue?

- Romain


2012/1/25 Pinaki Poddar <pp...@apache.org>

> > That's such a hook i'm looking for.
>  emf.getConfiguration()
>     .getLifecycleEventManagerInstance()
>     .addListener(Object listener, Class<?>[] classes);
>
> -----
> Pinaki Poddar
> Chair, Apache OpenJPA Project
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/JPA-2-1-tp7215602p7223252.html
> Sent from the OpenJPA Developers mailing list archive at Nabble.com.
>

Re: JPA 2.1?

Posted by Pinaki Poddar <pp...@apache.org>.
> That's such a hook i'm looking for. 
 emf.getConfiguration()
     .getLifecycleEventManagerInstance()
     .addListener(Object listener, Class<?>[] classes);

-----
Pinaki Poddar
Chair, Apache OpenJPA Project
--
View this message in context: http://openjpa.208410.n2.nabble.com/JPA-2-1-tp7215602p7223252.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.

Re: JPA 2.1?

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Today (and if i understood the code ;)) when i set an entity listener
OpenJPA will do a new in the class.

what i would like is to be able to give the instance to OpenJPA. Like this
the instance could be managed by CDI and i could inject anything inside it.

That's such a hook i'm looking for.

- Romain


2012/1/23 Kevin Sutter <kw...@gmail.com>

> There has been no official development effort kicked off for JPA 2.1 yet.
>  The numbering of OpenJPA releases is not in synch with the JPA
> specification levels.  OpenJPA's trunk development line is still based off
> the JPA 2.0 specification.
>
> And, as far as Entity Listeners are concerned, we've had an implementation
> [1] for these for quite some time.  Is there some new feature of these that
> are you looking for?
>
> Kevin
>
> [1]
>
> http://openjpa.apache.org/builds/latest/docs/manual/manual.html#jpa_overview_entity_listeners_using
>
> On Mon, Jan 23, 2012 at 2:57 AM, Romain Manni-Bucau
> <rm...@gmail.com>wrote:
>
> > Hi,
> >
> > is there any work on JPA 2.1?
> >
> > participating in the development of OpenEJB i'm particularly interested
> in
> > the entity  listener part which should be cdi beans now.
> >
> > currently OpenEJB is using openjpa 2.1.1 and i didnt find any hook to
> > provide an instance of the entity listener.
> >
> > is there already such a feature on trunk?
> >
> > - Romain
> >
>

Re: JPA 2.1?

Posted by Kevin Sutter <kw...@gmail.com>.
There has been no official development effort kicked off for JPA 2.1 yet.
 The numbering of OpenJPA releases is not in synch with the JPA
specification levels.  OpenJPA's trunk development line is still based off
the JPA 2.0 specification.

And, as far as Entity Listeners are concerned, we've had an implementation
[1] for these for quite some time.  Is there some new feature of these that
are you looking for?

Kevin

[1]
http://openjpa.apache.org/builds/latest/docs/manual/manual.html#jpa_overview_entity_listeners_using

On Mon, Jan 23, 2012 at 2:57 AM, Romain Manni-Bucau
<rm...@gmail.com>wrote:

> Hi,
>
> is there any work on JPA 2.1?
>
> participating in the development of OpenEJB i'm particularly interested in
> the entity  listener part which should be cdi beans now.
>
> currently OpenEJB is using openjpa 2.1.1 and i didnt find any hook to
> provide an instance of the entity listener.
>
> is there already such a feature on trunk?
>
> - Romain
>