Community
Participate
Working Groups
Build Identifier: version:2.3.2 Build id:v20111125-r10461 For example, there are two entities: node and nodegroup. nodegroup and node have an one-to-many relationship. When a EntityManager flush method is issued right after the remove method, the eclipselink throws a java.sql.SQLIntegrityConstraintViolationException. If eclipselink 2.2.1 is used, there is no such error is reported. As you can see the first line of the log, the remove() method has the Nodegroup associated. However, it throws the exception to complaint the nodegroup is associated in the internal update() call. ================================================== [EL Finest]: 2012-05-08 16:02:56.996--UnitOfWork(848123013)--Thread(Thread[main,5,main])--remove() operation called on: Node[nodeId=105,nodes={[]},nodeGroupId=Nodegroup[nodes={[]},nodeGroupName=nodeGroupName_5,comment=comment_5,creatorId=5,creationTime=Tue May 08 16:13:59 EDT 2012,type=5,flags=5,nodeGroupId=97],proxyNodeId=persistence.jpa.entities.Node@557e5cbd,nodeName=nodeName_3,nodeAddress=nodeAddress_3,userName=userName_3,password=password_3,comment=comment_3,creatorId=3,creationTime=Tue May 08 16:16:49 EDT 2012,type=3,flags=3,features=3,hostId=hostId_3,policies={[]}] 16:02:56.997 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'transactionManager' 16:02:56.997 [main] DEBUG o.s.orm.jpa.JpaTransactionManager - Found thread-bound EntityManager [org.eclipse.persistence.internal.jpa.EntityManagerImpl@788bf135] for JPA transaction 16:02:56.997 [main] DEBUG o.s.orm.jpa.JpaTransactionManager - Participating in existing transaction [EL Finer]: 2012-05-08 16:02:56.998--UnitOfWork(848123013)--Thread(Thread[main,5,main])--begin unit of work flush [EL Finest]: 2012-05-08 16:02:57.002--UnitOfWork(848123013)--Thread(Thread[main,5,main])--Execute query DataModifyQuery(name="policies" ) [EL Fine]: 2012-05-08 16:02:57.002--ClientSession(730401895)--Connection(93216445)--Thread(Thread[main,5,main])--DELETE FROM nodepolicy WHERE (nodeID = ?) bind => [105] [EL Finest]: 2012-05-08 16:02:57.012--ClientSession(730401895)--Connection(93216445)--Thread(Thread[main,5,main])--No row was found for FETCH, UPDATE or DELETE; or the result of a query is an empty table.:02000 - null [EL Finest]: 2012-05-08 16:02:57.013--UnitOfWork(848123013)--Thread(Thread[main,5,main])--Execute query DeleteObjectQuery(Node[nodeId=105,nodes={[]},nodeGroupId=Nodegroup[nodes={[]},nodeGroupName=nodeGroupName_5,comment=comment_5,creatorId=5,creationTime=Tue May 08 16:13:59 EDT 2012,type=5,flags=5,nodeGroupId=97],proxyNodeId=persistence.jpa.entities.Node@557e5cbd,nodeName=nodeName_3,nodeAddress=nodeAddress_3,userName=userName_3,password=password_3,comment=comment_3,creatorId=3,creationTime=Tue May 08 16:16:49 EDT 2012,type=3,flags=3,features=3,hostId=hostId_3,policies={[]}]) [EL Finest]: 2012-05-08 16:02:57.013--UnitOfWork(848123013)--Thread(Thread[main,5,main])--Execute query DeleteObjectQuery(Node[nodeId=105,nodes={[]},nodeGroupId=Nodegroup[nodes={[]},nodeGroupName=nodeGroupName_5,comment=comment_5,creatorId=5,creationTime=Tue May 08 16:13:59 EDT 2012,type=5,flags=5,nodeGroupId=97],proxyNodeId=persistence.jpa.entities.Node@557e5cbd,nodeName=nodeName_3,nodeAddress=nodeAddress_3,userName=userName_3,password=password_3,comment=comment_3,creatorId=3,creationTime=Tue May 08 16:16:49 EDT 2012,type=3,flags=3,features=3,hostId=hostId_3,policies={[]}]) [EL Fine]: 2012-05-08 16:02:57.014--ClientSession(730401895)--Connection(93216445)--Thread(Thread[main,5,main])--UPDATE node SET nodeGroupID = ? WHERE (nodeID = ?) bind => [null, 105] [EL Fine]: 2012-05-08 16:02:57.025--ClientSession(730401895)--Thread(Thread[main,5,main])--VALUES(1) [EL Warning]: 2012-05-08 16:02:57.026--UnitOfWork(848123013)--Thread(Thread[main,5,main])--Local Exception Stack: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLIntegrityConstraintViolationException: Column 'NODEGROUPID' cannot accept a NULL value. Error Code: 20000 Call: UPDATE node SET nodeGroupID = ? WHERE (nodeID = ?) bind => [null, 105] Query: DeleteObjectQuery(Node[nodeId=105,nodes={[]},nodeGroupId=Nodegroup[nodes={[]},nodeGroupName=nodeGroupName_5,comment=comment_5,creatorId=5,creationTime=Tue May 08 16:13:59 EDT 2012,type=5,flags=5,nodeGroupId=97],proxyNodeId=persistence.jpa.entities.Node@557e5cbd,nodeName=nodeName_3,nodeAddress=nodeAddress_3,userName=userName_3,password=password_3,comment=comment_3,creatorId=3,creationTime=Tue May 08 16:16:49 EDT 2012,type=3,flags=3,features=3,hostId=hostId_3,policies={[]}]) at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:324) ==================================================================== Reproducible: Always Steps to Reproduce: always reproduce with our current codes.
Please provide code to reproduce the problem.
Possibly related to: https://bugs.eclipse.org/bugs/show_bug.cgi?id=341709
(In reply to comment #2) > Possibly related to: https://bugs.eclipse.org/bugs/show_bug.cgi?id=341709 I am going to produce a simple case right now and send you the codes later. Thanks.
Created attachment 215783 [details] A tar file for the Spring STS project that reproduces the issue Please extract STS project from the tar.zip file. Then run the (maven) mvn test. The eclipselink debug has been turned on. The testremove() method gets failure for the case. You will see the issues. Check the log file under target/surefire-reports directory. The log file name is persistence.jpa.entities.NodeIntegrationTest-output.txt.
FYI: 341709 is now fixed in 2.4.0. Can you please try the latest 2.4 build and see if you still have the issue. (note, for the fix to work, you will have to specify that any columns with non null constraints are non null in your JPA metadata)
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink