openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacek Laskowski" <ja...@laskowski.net.pl>
Subject Re: @ElementDependent and cascade-delete
Date Thu, 19 Apr 2007 08:44:04 GMT
On 4/19/07, roger.keays <roger.keays@ninthavenue.com.au> wrote:

> I have a list which is marked @ElementDependent and also CascadeType.ALL.
> Adding and removing items from the list works fine, and those elements are
> deleted from the database. When I try to delete the owning entity though, I
> get the exception below.
...
> <2|false|0.9.6-incubating>
> org.apache.openjpa.persistence.OptimisticLockException: An
>  optimistic lock violation was detected when flushing object instance
>  "figbird.users.entities.RoleMapping-figbird.users.entities.RoleMapping-5"
>  to the data store. This indicates that the object was concurrently modified
> in another
>  transaction. FailedObject:
> figbird.users.entities.RoleMapping-figbird.users.entities.RoleMapping-5

I think I've seen the error message when @Version attributes have been
used. Do you happen to use it in the entities of yours? Could you
elaborate a bit more about your application? How does the
persistence.xml look like? Could you narrow down the issue to some
test case?

I guess you want to work around the issue of orphaned keys [1], don't
you? If so, there's a note that "One way of avoiding orphaned keys is
to use dependent fields.", so I guess (again), there must be another
way to work it out as it's noted as 'one way' ;-)

[1] http://incubator.apache.org/openjpa/docs/latest/manual/manual.html#ref_guide_orphan

-- 
Jacek Laskowski
http://www.JacekLaskowski.pl

Mime
View raw message