You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Hal Hildebrand <ha...@me.com> on 2015/02/22 22:29:24 UTC

Lifecycle events?

So, I’m trying to use the lifecycle events on the OpenJPAEntityManagerSPI.  I’ve created a class which implements PersistListener, UpdateListener, DeleteListener.  I’ve registered an instance of this class as a lifecycle listener:

OpenJPAEntityManagerSPI openJpaEm = em.unwrap(OpenJPAEntityManagerSPI.class);
openJpaEm.addLifecycleListener(this);

This does not seem to do anything at all.  I’ve got printlns in every event and I get nothing.  I have registered the txn listener successfully, and that works great.

Is there something I’m missing here?

Any help appreciated.

Thanks,

-Hal

Re: Lifecycle events?

Posted by Hal Hildebrand <ha...@me.com>.
no problem.  the work around works just fine.

Much appreciated ;)

Also, too, facepalm because I actually thought I’d tried this.

> On Feb 25, 2015, at 6:58 AM, Rick Curtis <cu...@gmail.com> wrote:
> 
> This is a bug. It will work if you specify a list of classes that you're
> interested in or null. (You shouldn't have to pass null, but that is the
> bug)
> 
> openJpaEm.addLifecycleListener(this, Class1.class, Class2.class);
> 
> or
> 
> openJpaEm.addLifecycleListener(this, null);
> 
> On Wed, Feb 25, 2015 at 8:14 AM, Hal Hildebrand <ha...@me.com>
> wrote:
> 
>> So, this is just a dead parrot?  I couldn't find anything through web
>> searches. Can I get a read as to whether this is supposed to work or even a
>> code sample?
>> 
>> Thanks.
>> 
>> 
>> 
>>> On Feb 22, 2015, at 1:29 PM, Hal Hildebrand <ha...@me.com>
>> wrote:
>>> 
>>> So, I'm trying to use the lifecycle events on the
>> OpenJPAEntityManagerSPI.  I've created a class which implements
>> PersistListener, UpdateListener, DeleteListener.  I've registered an
>> instance of this class as a lifecycle listener:
>>> 
>>> OpenJPAEntityManagerSPI openJpaEm =
>> em.unwrap(OpenJPAEntityManagerSPI.class);
>>> openJpaEm.addLifecycleListener(this);
>>> 
>>> This does not seem to do anything at all.  I've got printlns in every
>> event and I get nothing.  I have registered the txn listener successfully,
>> and that works great.
>>> 
>>> Is there something I'm missing here?
>>> 
>>> Any help appreciated.
>>> 
>>> Thanks,
>>> 
>>> -Hal
>> 
> 
> 
> 
> -- 
> *Rick Curtis*


Re: Lifecycle events?

Posted by Rick Curtis <cu...@gmail.com>.
This is a bug. It will work if you specify a list of classes that you're
interested in or null. (You shouldn't have to pass null, but that is the
bug)

openJpaEm.addLifecycleListener(this, Class1.class, Class2.class);

or

openJpaEm.addLifecycleListener(this, null);

On Wed, Feb 25, 2015 at 8:14 AM, Hal Hildebrand <ha...@me.com>
wrote:

> So, this is just a dead parrot?  I couldn't find anything through web
> searches. Can I get a read as to whether this is supposed to work or even a
> code sample?
>
> Thanks.
>
>
>
> > On Feb 22, 2015, at 1:29 PM, Hal Hildebrand <ha...@me.com>
> wrote:
> >
> > So, I'm trying to use the lifecycle events on the
> OpenJPAEntityManagerSPI.  I've created a class which implements
> PersistListener, UpdateListener, DeleteListener.  I've registered an
> instance of this class as a lifecycle listener:
> >
> > OpenJPAEntityManagerSPI openJpaEm =
> em.unwrap(OpenJPAEntityManagerSPI.class);
> > openJpaEm.addLifecycleListener(this);
> >
> > This does not seem to do anything at all.  I've got printlns in every
> event and I get nothing.  I have registered the txn listener successfully,
> and that works great.
> >
> > Is there something I'm missing here?
> >
> > Any help appreciated.
> >
> > Thanks,
> >
> > -Hal
>



-- 
*Rick Curtis*

Re: Lifecycle events?

Posted by Hal Hildebrand <ha...@me.com>.
So, this is just a dead parrot?  I couldn't find anything through web searches. Can I get a read as to whether this is supposed to work or even a code sample?

Thanks. 



> On Feb 22, 2015, at 1:29 PM, Hal Hildebrand <ha...@me.com> wrote:
> 
> So, I’m trying to use the lifecycle events on the OpenJPAEntityManagerSPI.  I’ve created a class which implements PersistListener, UpdateListener, DeleteListener.  I’ve registered an instance of this class as a lifecycle listener:
> 
> OpenJPAEntityManagerSPI openJpaEm = em.unwrap(OpenJPAEntityManagerSPI.class);
> openJpaEm.addLifecycleListener(this);
> 
> This does not seem to do anything at all.  I’ve got printlns in every event and I get nothing.  I have registered the txn listener successfully, and that works great.
> 
> Is there something I’m missing here?
> 
> Any help appreciated.
> 
> Thanks,
> 
> -Hal