You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Kevin Sutter <kw...@gmail.com> on 2009/03/10 14:19:25 UTC

Re: Event was not fired for child entity when cascading deleting happens

Hi,
What version of OpenJPA are you running with?  There was an issue with a
previous version of OpenJPA where the entity listeners were not called
consistently.

Thanks,
Kevin

On Mon, Mar 9, 2009 at 2:26 PM, hairinwind <Do...@elasticpath.com> wrote:

>
> Event was not fired for child entity when cascading deleting happens.
>
> For example, The parent entity has the reference of the child entity and
> the
> cascade type is ALL.
>
> While save the parent entity, it will also save the child entity. The
> persist listener is triggered twice. One for parent entity and the other
> one
> is for the child entity.
>
> But when delete the parent entity, the delete listener is only triggered
> once for the parent entity.
>
> How can I make the listener also be triggered for the child entity?
>
> Thanks!
> --
> View this message in context:
> http://n2.nabble.com/Event-was-not-fired-for-child-entity-when-cascading-deleting-happens-tp2451102p2451102.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
>

Re: Event was not fired for child entity when cascading deleting happens

Posted by Kevin Sutter <kw...@gmail.com>.
Excellent.  Thanks for the reply.  Good luck with the rest of your
development and testing!

Kevin

On Tue, Mar 10, 2009 at 11:18 AM, hairinwind <Do...@elasticpath.com>wrote:

>
> Thanks, we are using version 1.0.2
>
> I found it is my fault. I removed the listeners too early. The openjpa does
> not execute the sql statement until commit or flush. It does not know the
> child should be cascade deleted until it is really going to delete the
> parent record from the database.
>
>
>
>
>
>
>
>
> Kevin Sutter wrote:
> >
> > Hi,
> > What version of OpenJPA are you running with?  There was an issue with a
> > previous version of OpenJPA where the entity listeners were not called
> > consistently.
> >
> > Thanks,
> > Kevin
> >
> > On Mon, Mar 9, 2009 at 2:26 PM, hairinwind <Do...@elasticpath.com>
> > wrote:
> >
> >>
> >> Event was not fired for child entity when cascading deleting happens.
> >>
> >> For example, The parent entity has the reference of the child entity and
> >> the
> >> cascade type is ALL.
> >>
> >> While save the parent entity, it will also save the child entity. The
> >> persist listener is triggered twice. One for parent entity and the other
> >> one
> >> is for the child entity.
> >>
> >> But when delete the parent entity, the delete listener is only triggered
> >> once for the parent entity.
> >>
> >> How can I make the listener also be triggered for the child entity?
> >>
> >> Thanks!
> >> --
> >> View this message in context:
> >>
> http://n2.nabble.com/Event-was-not-fired-for-child-entity-when-cascading-deleting-happens-tp2451102p2451102.html
> >> Sent from the OpenJPA Users mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://n2.nabble.com/Event-was-not-fired-for-child-entity-when-cascading-deleting-happens-tp2451102p2456165.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
>

Re: Event was not fired for child entity when cascading deleting happens

Posted by hairinwind <Do...@elasticpath.com>.
Thanks, we are using version 1.0.2 

I found it is my fault. I removed the listeners too early. The openjpa does
not execute the sql statement until commit or flush. It does not know the
child should be cascade deleted until it is really going to delete the
parent record from the database.








Kevin Sutter wrote:
> 
> Hi,
> What version of OpenJPA are you running with?  There was an issue with a
> previous version of OpenJPA where the entity listeners were not called
> consistently.
> 
> Thanks,
> Kevin
> 
> On Mon, Mar 9, 2009 at 2:26 PM, hairinwind <Do...@elasticpath.com>
> wrote:
> 
>>
>> Event was not fired for child entity when cascading deleting happens.
>>
>> For example, The parent entity has the reference of the child entity and
>> the
>> cascade type is ALL.
>>
>> While save the parent entity, it will also save the child entity. The
>> persist listener is triggered twice. One for parent entity and the other
>> one
>> is for the child entity.
>>
>> But when delete the parent entity, the delete listener is only triggered
>> once for the parent entity.
>>
>> How can I make the listener also be triggered for the child entity?
>>
>> Thanks!
>> --
>> View this message in context:
>> http://n2.nabble.com/Event-was-not-fired-for-child-entity-when-cascading-deleting-happens-tp2451102p2451102.html
>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://n2.nabble.com/Event-was-not-fired-for-child-entity-when-cascading-deleting-happens-tp2451102p2456165.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.