You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by rgarret <RG...@co.pierce.wa.us> on 2008/06/02 19:25:58 UTC
RE: ON DELETE CASCADE causes OptimisticLockingException
I started OPENJPA-235 some time ago and it has yet to be resolved. I haven't
had time to inquire about it but I really wish it would get paid some
attention. It seems to me that properly managing foreign/unique keys during
update/delete operations is fairly important.
roger.keays wrote:
>
> It seems that the new ConstraintUpdateManager, which was added to openjpa
> to fix NOT NULL foreign keys is the cause of this problem:
>
> https://issues.apache.org/jira/browse/OPENJPA-235
>
> The old OperationOrderUpdateManager still works in the same way as 0.9.7
> and can be enabled with
>
> openjpa.jdbc.UpdateManager=operation-order
>
> Marc LaPierre wrote:
>>
>> From what I understand, JPA tries to delete the parent entity before the
>> child entity, which is incorrect. There is a JIRA issue for this:
>>
>> http://issues.apache.org/jira/browse/OPENJPA-39
>>
>> It's been marked as "fixed" but I still see that behavior. I ended up
>> manually doing the deletes when required instead of relying on cascade.
>>
>> Marc
>>
>>
>> -----Original Message-----
>> From: roger.keays [mailto:roger.keays@ninthavenue.com.au]
>> Sent: Wednesday, March 05, 2008 7:55 AM
>> To: users@openjpa.apache.org
>> Subject: Re: ON DELETE CASCADE causes OptimisticLockingException
>>
>>
>>
>> roger.keays wrote:
>>> Since upgrading to 1.0.0, all my CASCADE DELETE foreign key actions
>> cause
>>> an OptimisticLockingException when you delete the owning entity. This
>>> happens even if @ForeignKey describes the delete action correctly.
>>>
>> This is still a problem in 1.0.2 with postgresql. Can anybody help me? I
>> tried
>>
>> openjpa.jdbc.UpdateManager=org.apache.openjpa.jdbc.kernel.ConstraintUpda
>> teManager
>>
>> since the foreign keys cause the problem, but it doesn't help. Also, I
>> noticed the openjpa.Compatibility config option, but no docs on what
>> values
>> are allowed here. The working version of openjpa is 0.9.7. Is it
>> possible to
>> imitate that version?
>>
>> Thanks in advance,
>>
>> Roger
>>
>>
>>> e.g
>>>
>>> @Entity A {
>>> @OneToMany(cascade=CascadeType.ALL, mappedBy="a")
>>> List b;
>>> }
>>>
>>> @Entity B {
>>> @ForeignKey(deleteAction=ForeignKeyAction.CASCADE)
>>> @ManyToOne(cascade=CascadeType.MERGE)
>>> A a;
>>> }
>>>
>>> If I delete A when there is a cascading foreign key the exception is
>>> thrown. Without the key, there is no exception.
>>>
>>> Roger
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/ON-DELETE-CASCADE-causes-OptimisticLockingExceptio
>> n-tp14308483p15849421.html
>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> This transmission (including any attachments) may contain confidential
>> information, privileged material (including material protected by the
>> solicitor-client or other applicable privileges), or constitute
>> non-public information. Any use of this information by anyone other than
>> the intended recipient is prohibited. If you have received this
>> transmission in error, please immediately reply to the sender and delete
>> this information from your system. Use, dissemination, distribution, or
>> reproduction of this transmission by unintended recipients is not
>> authorized and may be unlawful.
>>
>>
>
>
--
View this message in context: http://www.nabble.com/ON-DELETE-CASCADE-causes-OptimisticLockingException-tp14308483p17606217.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.