Hi Jacek,

Thanks for the reply.

Jacek Laskowski-4 wrote:
> On 4/19/07, roger.keays <[EMAIL PROTECTED]> 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've narrowed the problem down to a foreign key constraint. It occurs when I

ALTER TABLE fb_user_roles ADD FOREIGN KEY (username) REFERENCES fb_users

If I use ON DELETE RESTRICT, there is a foreign key exception when deleting
the user. If I use ON DELETE SET NULL, it is okay, although not that's
necessarily the behaviour I'd like.

This seems to be a problem with the ordering of delete statements which I
have run into before:


View this message in context: 
Sent from the open-jpa-dev mailing list archive at Nabble.com.

Reply via email to