openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From susanne_j <>
Subject Problem with the optimistic locking id after a unique constraint violation exception
Date Mon, 14 Oct 2013 12:24:51 GMT
Hello openjpa list,

I currently have the following problem and I'm now a bit helpless, how I
could avoid it ...

I'm using an optimistic locking id in my table and I have a
unique-constraint on this table.

If the user now maintains the fields, that all ends up in an attempt to save
the record which results in a unique-constraint violation exception (with an
automatic rollback), I show the exception to the user and the user has the
possibility to change the fields for the unique-constraint. I open a new
transaction and try to merge the - now detached - object with the former
uc-violation back into the new transaction-context. But now the merge call
runs into an optimistic locking exception
"Attempted to attach deleted instance type "class xxx.StGsPartner" with oid
"9".  If the instance is new, the version field should be left to its
default value."

Is the entity deleted after the unique-constraint violation excption? And do
I have to create new Instances of the object and all it's associated ones?
Or is there another way to get the object (and the associated) back into the

Thanks in advance if you could help me with it!

Best regards,

View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message