You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Victor Smith <va...@gmail.com> on 2012/02/03 23:39:19 UTC

remove() followed by persist() inside transaction breaking unique constraint

Hello,

 I have run into the following issue - a later persist() operation is
causing unique constraint even though a remove() operation is preceding it
inside the transaction block.



I'm using openJPA 1.2.3 with J2EE 5.0 and WebSphere 7.0.

Thank you,
Victor

******************************
Snippet error messages are shown below-

[

--
View this message in context: http://openjpa.208410.n2.nabble.com/remove-followed-by-persist-inside-transaction-breaking-unique-constraint-tp7252489p7252489.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: remove() followed by persist() inside transaction breaking unique constraint

Posted by SRINIVASA REDDY <bs...@gmail.com>.

Hi,


I am getting below can below some help Us...


Persistence operation could not be executed. Nested exception: The
transaction has been rolled back. See the nested exceptions for details on
the errors that occurred. 






--
View this message in context: http://openjpa.208410.n2.nabble.com/remove-followed-by-persist-inside-transaction-breaking-unique-constraint-tp7252489p7582713.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: remove() followed by persist() inside transaction breaking unique constraint

Posted by Victor Smith <va...@gmail.com>.
I'm glad to report that I have found a solution - by calling em.flush() and
em.clear() between remove() and persist() operations as follows:




--
View this message in context: http://openjpa.208410.n2.nabble.com/remove-followed-by-persist-inside-transaction-breaking-unique-constraint-tp7252489p7270712.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.