Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 333476 - Delete Order incorrect when deleting objects with self-referencing relationships
Summary: Delete Order incorrect when deleting objects with self-referencing relationships
Status: CLOSED DUPLICATE of bug 328040
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-04 09:40 EST by Tom Ware CLA
Modified: 2022-06-09 10:34 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Ware CLA 2011-01-04 09:40:35 EST
The following benchmark page shows an issue with deleteing objects with self referencing relationships.

http://www.jpab.org/All/All/All.html

Although the benchmark itself is likely designed to show ObjectDB as faster than other providers and therefore does not carry much weight, the 2 consistent failures should be fixed.

javax.persistence.RollbackException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.BatchUpdateException: DELETE on table 'NODE' caused a violation of foreign key constraint 'FK_NODE_CHILD2_ID' for key (130029).  The statement has been rolled back.
Error Code: 20000
	at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:102)
	at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:63)
	at org.jpab.Test.doAction(Test.java:272)
	at org.jpab.Runner$RemoveAction.run0(Runner.java:578)
	at org.jpab.Runner$TestAction.run(Runner.java:508)
	at java.lang.Thread.run(Thread.java:619)
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.BatchUpdateException: DELETE on table 'NODE' caused a violation of foreign key constraint 'FK_NODE_CHILD2_ID' for key (130029).  The statement has been rolled back.
Error Code: 20000
	at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:324)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeJDK12BatchStatement(DatabaseAccessor.java:830)
	at org.eclipse.persistence.internal.databaseaccess.ParameterizedSQLBatchWritingMechanism.executeBatchedStatements(ParameterizedSQLBatchWritingMechanism.java:139)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.writesCompleted(DatabaseAccessor.java:1632)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.commitTransaction(DatabaseAccessor.java:399)
	at org.eclipse.persistence.internal.sessions.AbstractSession.basicCommitTransaction(AbstractSession.java:504)
	at org.eclipse.persistence.sessions.server.ClientSession.basicCommitTransaction(ClientSession.java:155)
	at org.eclipse.persistence.internal.sessions.AbstractSession.commitTransaction(AbstractSession.java:686)
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitTransaction(UnitOfWorkImpl.java:1581)
	at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitTransaction(RepeatableWriteUnitOfWork.java:559)
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitTransactionAfterWriteChanges(UnitOfWorkImpl.java:1604)
	at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitRootUnitOfWork(RepeatableWriteUnitOfWork.java:207)
	at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitAndResume(UnitOfWorkImpl.java:1148)
	at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:84)
	... 5 more
Caused by: java.sql.BatchUpdateException: DELETE on table 'NODE' caused a violation of foreign key constraint 'FK_NODE_CHILD2_ID' for key (130029).  The statement has been rolled back.
	at org.apache.derby.impl.jdbc.EmbedStatement.executeBatch(Unknown Source)
	at org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.executeBatch(DatabasePlatform.java:1964)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeJDK12BatchStatement(DatabaseAccessor.java:817)
	... 17 more
Caused by: java.sql.SQLIntegrityConstraintViolationException: DELETE on table 'NODE' caused a violation of foreign key constraint 'FK_NODE_CHILD2_ID' for key (130029).  The statement has been rolled back.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
	at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeBatchElement(Unknown Source)
	... 20 more
Caused by: java.sql.SQLException: DELETE on table 'NODE' caused a violation of foreign key constraint 'FK_NODE_CHILD2_ID' for key (130029).  The statement has been rolled back.
	at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
	at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
	... 28 more
Caused by: ERROR 23503: DELETE on table 'NODE' caused a violation of foreign key constraint 'FK_NODE_CHILD2_ID' for key (130029).  The statement has been rolled back.
	at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
	at org.apache.derby.impl.sql.execute.ReferencedKeyRIChecker.doCheck(Unknown Source)
	at org.apache.derby.impl.sql.execute.RISetChecker.doPKCheck(Unknown Source)
	at org.apache.derby.impl.sql.execute.DeleteResultSet.runFkChecker(Unknown Source)
	at org.apache.derby.impl.sql.execute.DeleteResultSet.open(Unknown Source)
	at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
	... 22 more
Graph (Binary Tree) Test - Removal Operations - Many Entities (5000)
javax.persistence.RollbackException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.BatchUpdateException: DELETE on table 'NODE' caused a violation of foreign key constraint 'FK_NODE_CHILD1_ID' for key (126348).  The statement has been rolled back.
Error Code
Comment 1 Tom Ware CLA 2011-01-05 13:58:47 EST

*** This bug has been marked as a duplicate of bug 328040 ***
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:34:11 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink