openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Linskey <plins...@gmail.com>
Subject Re: OptimisticLockingException, Cascade-Merge and foreign keys
Date Mon, 30 Jun 2008 17:28:38 GMT
Hi,

Can you post the SQL that is generated? Also, which update manager  
were you using when this happened?

-Patrick

On Jun 30, 2008, at 2:58 AM, Roger Keays wrote:

> Hi,
>
> Given the following domain model on 1.1.0, I get an  
> OptimisticLockingException when doing an em.remove(a):
>
> @Entity A {
>  @OneToMany(cascade=CascadeType.ALL, mappedBy="a")
>  List b;
> }
>
> @Entity B {
>  @ForeignKey(cascadeAction=ForeignKeyAction.CASCADE,  
> deleteAction=ForeignKeyAction.CASCADE, deferred=true)
>  @ManyToOne(cascade=CascadeType.MERGE)
>  A a;
> }
>
> I found two possible workarounds:
>  1. remove the Cascade-Merge, or
>  2. remove the foreign keys
>
> however I don't particularly like either solution. Is anybody able  
> to offer a better solution? Am I doing something wrong?
>
> Cheers,
>
> Roger
>

-- 
Patrick Linskey
202 669 5907


Mime
View raw message