[ https://issues.apache.org/jira/browse/OPENJPA-2408?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13702986#comment-13702986 ]
Luca Masini commented on OPENJPA-2408: -------------------------------------- Good morning Albert, in my opinion the issue is the same: 1) I have a detached Entity A, with its own @ID, passed to the merge method, OpenJPA 2.2.0 make a SELECT to see refresh it's current state into the EntityManager 2) For business reason the same exact entity A (but another instance inside the JVM) is passed to the merge method and OpenJPA again make a SELECT. 3) When I commit OpenJPA tries to insert it twice and of course I got a SQL Exception for PK violation. I tried with EclipseLink 2.3.2 and Hibernate 4.1.8.Final and with those two providers it works like I expected. Thank you. > CLONE - Merge of lazily fetched fields, and merge of managed entities > deviates from spec > ---------------------------------------------------------------------------------------- > > Key: OPENJPA-2408 > URL: https://issues.apache.org/jira/browse/OPENJPA-2408 > Project: OpenJPA > Issue Type: Bug > Components: jdbc > Affects Versions: 2.1.0, 2.2.0 > Reporter: Luca Masini > Assignee: Rick Curtis > Fix For: 2.2.0 > > > Attached is a test case that illustrates this fail (You can place it into > openjpa-persistence-jdbc/src/test/java/org.apache.openjpa.persistence.merge) > Problem 1: Section 3.2.7.1 (Merging Detached Entity State) of the > specification says that "The persistence provider must not merge fields > marked LAZY that have not been fetched: it must ignore such fields when > merging.". The attached test case illustrates that OpenJPA 2.1.0 does not > ignore fields marked LAZY that have not been fetched. > Problem 2: In the same section, the specification says "If X is a managed > entity, it is ignored by the merge operation...". But OpenJPA 2.1.0 doesn't > seem to ignore them. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira