Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349483 - @OneToMany fields are not being persisted in an @Embeddable object
Summary: @OneToMany fields are not being persisted in an @Embeddable object
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P2 major with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-15 14:03 EDT by Paul Harrison CLA
Modified: 2022-06-09 10:05 EDT (History)
2 users (show)

See Also:


Attachments
zip file containing test case (9.07 KB, application/zip)
2011-06-15 14:04 EDT, Paul Harrison CLA
no flags Details
updated test case (11.62 KB, application/zip)
2011-06-22 18:05 EDT, Paul Harrison CLA
no flags Details
simple proposed fix (3.85 KB, patch)
2011-06-23 14:44 EDT, Chris Delahunt CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Harrison CLA 2011-06-15 14:03:24 EDT
Build Identifier: 2.2.0

In an embedded object any @OneToMany fields which have a unidirectional relationship with the FK in the many side are not saved when the top level object is persisted. In the enclosed testcase the Emb class is an example of such an embeddable class. On saving the Container class, an embedded field such as the field "simple" is saved to the table Container, but no records are saved into the table "Many"

Reproducible: Always

Steps to Reproduce:
1. run the ContainerTest unit test in the enclosed testcase
2.
3.
Comment 1 Paul Harrison CLA 2011-06-15 14:04:33 EDT
Created attachment 198045 [details]
zip file containing test case
Comment 2 Paul Harrison CLA 2011-06-22 18:05:37 EDT
Created attachment 198436 [details]
updated test case

This new test case updates the previous one to add a new @OneToMany field with orphanRemoval=true.
In this new case the "more" field of the Emb class is not persisted (no "Another" objects are saved) but the "Many" objects are. It seems to me that eclipselink is erroneously removing the Another objects because of this flag even though they are still present in the collection field - in fact it seems that they are never persisted in the first place.
Comment 3 Paul Harrison CLA 2011-06-22 18:07:33 EDT
The log of running with orphanRemoval=true


[EL Finest]: 2011-06-22 22:54:28.919--ServerSession(1832874625)--Thread(Thread[main,5,main])--Begin predeploying Persistence Unit jpabug; session file:/Users/pharriso/eclipse/workspace2/jpabug/target/classes/_jpabug; state Initial; factoryCount 0
[EL Finest]: 2011-06-22 22:54:28.949--ServerSession(1832874625)--Thread(Thread[main,5,main])--property=eclipselink.orm.throw.exceptions; default value=true
[EL Finest]: 2011-06-22 22:54:29.0--ServerSession(1832874625)--Thread(Thread[main,5,main])--property=eclipselink.jpa.uppercase-column-names; value=true
[EL Finer]: 2011-06-22 22:54:29.001--ServerSession(1832874625)--Thread(Thread[main,5,main])--Searching for default mapping file in file:/Users/pharriso/eclipse/workspace2/jpabug/target/classes/
[EL Finer]: 2011-06-22 22:54:29.007--ServerSession(1832874625)--Thread(Thread[main,5,main])--Searching for default mapping file in file:/Users/pharriso/eclipse/workspace2/jpabug/target/classes/
[EL Config]: 2011-06-22 22:54:29.208--ServerSession(1832874625)--Thread(Thread[main,5,main])--The access type for the persistent class [class org.test.Many] is set to [FIELD].
[EL Config]: 2011-06-22 22:54:29.243--ServerSession(1832874625)--Thread(Thread[main,5,main])--The access type for the persistent class [class org.test.Container] is set to [FIELD].
[EL Config]: 2011-06-22 22:54:29.246--ServerSession(1832874625)--Thread(Thread[main,5,main])--The access type for the persistent class [class org.test.Another] is set to [FIELD].
[EL Config]: 2011-06-22 22:54:29.246--ServerSession(1832874625)--Thread(Thread[main,5,main])--The access type for the persistent class [class org.test.Emb] is set to [FIELD].
[EL Config]: 2011-06-22 22:54:29.265--ServerSession(1832874625)--Thread(Thread[main,5,main])--The target entity (reference) class for the one to many mapping element [field more] is being defaulted to: class org.test.Another.
[EL Config]: 2011-06-22 22:54:29.266--ServerSession(1832874625)--Thread(Thread[main,5,main])--The target entity (reference) class for the one to many mapping element [field lots] is being defaulted to: class org.test.Many.
[EL Config]: 2011-06-22 22:54:29.267--ServerSession(1832874625)--Thread(Thread[main,5,main])--The alias name for the entity class [class org.test.Many] is being defaulted to: Many.
[EL Config]: 2011-06-22 22:54:29.271--ServerSession(1832874625)--Thread(Thread[main,5,main])--The table name for entity [class org.test.Many] is being defaulted to: MANY.
[EL Config]: 2011-06-22 22:54:29.306--ServerSession(1832874625)--Thread(Thread[main,5,main])--The column name for element [field id] is being defaulted to: ID.
[EL Config]: 2011-06-22 22:54:29.327--ServerSession(1832874625)--Thread(Thread[main,5,main])--The column name for element [field other] is being defaulted to: OTHER.
[EL Config]: 2011-06-22 22:54:29.328--ServerSession(1832874625)--Thread(Thread[main,5,main])--The column name for element [field name] is being defaulted to: NAME.
[EL Config]: 2011-06-22 22:54:29.33--ServerSession(1832874625)--Thread(Thread[main,5,main])--The alias name for the entity class [class org.test.Container] is being defaulted to: Container.
[EL Config]: 2011-06-22 22:54:29.34--ServerSession(1832874625)--Thread(Thread[main,5,main])--The table name for entity [class org.test.Container] is being defaulted to: CONTAINER.
[EL Config]: 2011-06-22 22:54:29.341--ServerSession(1832874625)--Thread(Thread[main,5,main])--The column name for element [field id] is being defaulted to: ID.
[EL Config]: 2011-06-22 22:54:29.342--ServerSession(1832874625)--Thread(Thread[main,5,main])--The column name for element [field incnt] is being defaulted to: INCNT.
[EL Config]: 2011-06-22 22:54:29.343--ServerSession(1832874625)--Thread(Thread[main,5,main])--The column name for element [field simple] is being defaulted to: SIMPLE.
[EL Config]: 2011-06-22 22:54:29.344--ServerSession(1832874625)--Thread(Thread[main,5,main])--The alias name for the entity class [class org.test.Another] is being defaulted to: Another.
[EL Config]: 2011-06-22 22:54:29.345--ServerSession(1832874625)--Thread(Thread[main,5,main])--The table name for entity [class org.test.Another] is being defaulted to: ANOTHER.
[EL Config]: 2011-06-22 22:54:29.345--ServerSession(1832874625)--Thread(Thread[main,5,main])--The column name for element [field id] is being defaulted to: ID.
[EL Config]: 2011-06-22 22:54:29.346--ServerSession(1832874625)--Thread(Thread[main,5,main])--The column name for element [field foo] is being defaulted to: FOO.
[EL Config]: 2011-06-22 22:54:29.347--ServerSession(1832874625)--Thread(Thread[main,5,main])--The column name for element [field bar] is being defaulted to: BAR.
[EL Finest]: 2011-06-22 22:54:29.401--ServerSession(1832874625)--Thread(Thread[main,5,main])--End predeploying Persistence Unit jpabug; session file:/Users/pharriso/eclipse/workspace2/jpabug/target/classes/_jpabug; state Predeployed; factoryCount 0
[EL Finer]: 2011-06-22 22:54:29.402--Thread(Thread[main,5,main])--JavaSECMPInitializer - transformer is null.
[EL Finest]: 2011-06-22 22:54:29.402--ServerSession(1832874625)--Thread(Thread[main,5,main])--Begin predeploying Persistence Unit jpabug; session file:/Users/pharriso/eclipse/workspace2/jpabug/target/classes/_jpabug; state Predeployed; factoryCount 0
[EL Finest]: 2011-06-22 22:54:29.403--ServerSession(1832874625)--Thread(Thread[main,5,main])--End predeploying Persistence Unit jpabug; session file:/Users/pharriso/eclipse/workspace2/jpabug/target/classes/_jpabug; state Predeployed; factoryCount 1
[EL Finest]: 2011-06-22 22:54:29.411--ServerSession(1832874625)--Thread(Thread[main,5,main])--Begin deploying Persistence Unit jpabug; session file:/Users/pharriso/eclipse/workspace2/jpabug/target/classes/_jpabug; state Predeployed; factoryCount 1
[EL Finer]: 2011-06-22 22:54:29.424--ServerSession(1832874625)--Thread(Thread[main,5,main])--Could not initialize Validation Factory. Encountered following exception: java.lang.NoClassDefFoundError: javax/validation/Validation
[EL Finest]: 2011-06-22 22:54:29.433--ServerSession(1832874625)--Thread(Thread[main,5,main])--property=eclipselink.logging.level; value=FINEST; translated value=FINEST
[EL Finest]: 2011-06-22 22:54:29.434--ServerSession(1832874625)--Thread(Thread[main,5,main])--property=eclipselink.logging.level; value=FINEST; translated value=FINEST
[EL Finest]: 2011-06-22 22:54:29.434--ServerSession(1832874625)--Thread(Thread[main,5,main])--property=javax.persistence.jdbc.user; value=root
[EL Finest]: 2011-06-22 22:54:29.434--ServerSession(1832874625)--Thread(Thread[main,5,main])--property=javax.persistence.jdbc.password; value=xxxxxx
[EL Finest]: 2011-06-22 22:54:30.133--ServerSession(1832874625)--Thread(Thread[main,5,main])--property=eclipselink.target-database; value=MySQL; translated value=org.eclipse.persistence.platform.database.MySQLPlatform
[EL Finest]: 2011-06-22 22:54:30.135--ServerSession(1832874625)--Thread(Thread[main,5,main])--property=javax.persistence.jdbc.driver; value=com.mysql.jdbc.Driver
[EL Finest]: 2011-06-22 22:54:30.136--ServerSession(1832874625)--Thread(Thread[main,5,main])--property=javax.persistence.jdbc.url; value=jdbc:mysql://localhost:3306/registry
[EL Info]: 2011-06-22 22:54:30.137--ServerSession(1832874625)--Thread(Thread[main,5,main])--EclipseLink, version: Eclipse Persistence Services - 2.2.0.v20110202-r8913
[EL Config]: 2011-06-22 22:54:30.151--ServerSession(1832874625)--Connection(256728009)--Thread(Thread[main,5,main])--connecting(DatabaseLogin(
	platform=>MySQLPlatform
	user name=> "root"
	datasource URL=> "jdbc:mysql://localhost:3306/registry"
))
[EL Config]: 2011-06-22 22:54:30.431--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connected: jdbc:mysql://localhost:3306/registry
	User: root@localhost
	Database: MySQL  Version: 5.1.54
	Driver: MySQL-AB JDBC Driver  Version: mysql-connector-java-5.1.6 ( Revision: ${svn.Revision} )
[EL Finest]: 2011-06-22 22:54:30.432--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection acquired from connection pool [default].
[EL Finest]: 2011-06-22 22:54:30.433--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection released to connection pool [default].
[EL Finest]: 2011-06-22 22:54:30.453--ServerSession(1832874625)--Thread(Thread[main,5,main])--sequencing connected, state is Preallocation_Transaction_NoAccessor_State
[EL Finest]: 2011-06-22 22:54:30.453--ServerSession(1832874625)--Thread(Thread[main,5,main])--sequence SEQUENCE: preallocation size 50
[EL Finest]: 2011-06-22 22:54:30.453--ServerSession(1832874625)--Thread(Thread[main,5,main])--sequence SEQ_GEN: preallocation size 50
[EL Info]: 2011-06-22 22:54:30.509--ServerSession(1832874625)--Thread(Thread[main,5,main])--file:/Users/pharriso/eclipse/workspace2/jpabug/target/classes/_jpabug login successful
[EL Config]: 2011-06-22 22:54:30.529--Thread(Thread[main,5,main])--The default table generator could not locate or convert a java type (null) into a database type for database field (MANY.CONT_IDENTIFIER). The generator uses java.lang.String as default java type for the field.
[EL Config]: 2011-06-22 22:54:30.53--Thread(Thread[main,5,main])--The default table generator could not locate or convert a java type (null) into a database type for database field (ANOTHER.CONT_IDENTIFIER). The generator uses java.lang.String as default java type for the field.
[EL Finest]: 2011-06-22 22:54:30.531--ServerSession(1832874625)--Thread(Thread[main,5,main])--Execute query DataModifyQuery(sql="ALTER TABLE MANY DROP FOREIGN KEY FK_MANY_CONT_IDENTIFIER")
[EL Finest]: 2011-06-22 22:54:30.532--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection acquired from connection pool [default].
[EL Fine]: 2011-06-22 22:54:30.533--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--ALTER TABLE MANY DROP FOREIGN KEY FK_MANY_CONT_IDENTIFIER
[EL Fine]: 2011-06-22 22:54:30.551--ServerSession(1832874625)--Thread(Thread[main,5,main])--SELECT 1
[EL Finest]: 2011-06-22 22:54:30.553--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection released to connection pool [default].
[EL Warning]: 2011-06-22 22:54:30.554--ServerSession(1832874625)--Thread(Thread[main,5,main])--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'registry.MANY' doesn't exist
Error Code: 1146
Call: ALTER TABLE MANY DROP FOREIGN KEY FK_MANY_CONT_IDENTIFIER
Query: DataModifyQuery(sql="ALTER TABLE MANY DROP FOREIGN KEY FK_MANY_CONT_IDENTIFIER")
[EL Finest]: 2011-06-22 22:54:30.575--ServerSession(1832874625)--Thread(Thread[main,5,main])--Execute query DataModifyQuery(sql="ALTER TABLE ANOTHER DROP FOREIGN KEY FK_ANOTHER_CONT_IDENTIFIER")
[EL Finest]: 2011-06-22 22:54:30.576--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection acquired from connection pool [default].
[EL Fine]: 2011-06-22 22:54:30.576--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--ALTER TABLE ANOTHER DROP FOREIGN KEY FK_ANOTHER_CONT_IDENTIFIER
[EL Fine]: 2011-06-22 22:54:30.577--ServerSession(1832874625)--Thread(Thread[main,5,main])--SELECT 1
[EL Finest]: 2011-06-22 22:54:30.578--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection released to connection pool [default].
[EL Warning]: 2011-06-22 22:54:30.578--ServerSession(1832874625)--Thread(Thread[main,5,main])--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'registry.ANOTHER' doesn't exist
Error Code: 1146
Call: ALTER TABLE ANOTHER DROP FOREIGN KEY FK_ANOTHER_CONT_IDENTIFIER
Query: DataModifyQuery(sql="ALTER TABLE ANOTHER DROP FOREIGN KEY FK_ANOTHER_CONT_IDENTIFIER")
[EL Finest]: 2011-06-22 22:54:30.579--ServerSession(1832874625)--Thread(Thread[main,5,main])--Execute query DataModifyQuery(sql="DROP TABLE CONTAINER")
[EL Finest]: 2011-06-22 22:54:30.579--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection acquired from connection pool [default].
[EL Fine]: 2011-06-22 22:54:30.579--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--DROP TABLE CONTAINER
[EL Fine]: 2011-06-22 22:54:30.581--ServerSession(1832874625)--Thread(Thread[main,5,main])--SELECT 1
[EL Finest]: 2011-06-22 22:54:30.581--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection released to connection pool [default].
[EL Warning]: 2011-06-22 22:54:30.582--ServerSession(1832874625)--Thread(Thread[main,5,main])--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown table 'CONTAINER'
Error Code: 1051
Call: DROP TABLE CONTAINER
Query: DataModifyQuery(sql="DROP TABLE CONTAINER")
[EL Finest]: 2011-06-22 22:54:30.582--ServerSession(1832874625)--Thread(Thread[main,5,main])--Execute query DataModifyQuery(sql="CREATE TABLE CONTAINER (ID INTEGER NOT NULL, INCNT VARCHAR(255), SIMPLE VARCHAR(255), PRIMARY KEY (ID))")
[EL Finest]: 2011-06-22 22:54:30.582--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection acquired from connection pool [default].
[EL Fine]: 2011-06-22 22:54:30.583--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--CREATE TABLE CONTAINER (ID INTEGER NOT NULL, INCNT VARCHAR(255), SIMPLE VARCHAR(255), PRIMARY KEY (ID))
[EL Finest]: 2011-06-22 22:54:30.687--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection released to connection pool [default].
[EL Finest]: 2011-06-22 22:54:30.688--ServerSession(1832874625)--Thread(Thread[main,5,main])--Execute query DataModifyQuery(sql="DROP TABLE MANY")
[EL Finest]: 2011-06-22 22:54:30.688--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection acquired from connection pool [default].
[EL Fine]: 2011-06-22 22:54:30.688--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--DROP TABLE MANY
[EL Fine]: 2011-06-22 22:54:30.689--ServerSession(1832874625)--Thread(Thread[main,5,main])--SELECT 1
[EL Finest]: 2011-06-22 22:54:30.69--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection released to connection pool [default].
[EL Warning]: 2011-06-22 22:54:30.69--ServerSession(1832874625)--Thread(Thread[main,5,main])--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown table 'MANY'
Error Code: 1051
Call: DROP TABLE MANY
Query: DataModifyQuery(sql="DROP TABLE MANY")
[EL Finest]: 2011-06-22 22:54:30.69--ServerSession(1832874625)--Thread(Thread[main,5,main])--Execute query DataModifyQuery(sql="CREATE TABLE MANY (ID INTEGER NOT NULL, NAME VARCHAR(255), OTHER INTEGER, CONT_IDENTIFIER INTEGER, PRIMARY KEY (ID))")
[EL Finest]: 2011-06-22 22:54:30.69--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection acquired from connection pool [default].
[EL Fine]: 2011-06-22 22:54:30.69--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--CREATE TABLE MANY (ID INTEGER NOT NULL, NAME VARCHAR(255), OTHER INTEGER, CONT_IDENTIFIER INTEGER, PRIMARY KEY (ID))
[EL Finest]: 2011-06-22 22:54:31.039--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection released to connection pool [default].
[EL Finest]: 2011-06-22 22:54:31.04--ServerSession(1832874625)--Thread(Thread[main,5,main])--Execute query DataModifyQuery(sql="DROP TABLE ANOTHER")
[EL Finest]: 2011-06-22 22:54:31.04--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection acquired from connection pool [default].
[EL Fine]: 2011-06-22 22:54:31.04--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--DROP TABLE ANOTHER
[EL Fine]: 2011-06-22 22:54:31.041--ServerSession(1832874625)--Thread(Thread[main,5,main])--SELECT 1
[EL Finest]: 2011-06-22 22:54:31.041--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection released to connection pool [default].
[EL Warning]: 2011-06-22 22:54:31.041--ServerSession(1832874625)--Thread(Thread[main,5,main])--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown table 'ANOTHER'
Error Code: 1051
Call: DROP TABLE ANOTHER
Query: DataModifyQuery(sql="DROP TABLE ANOTHER")
[EL Finest]: 2011-06-22 22:54:31.042--ServerSession(1832874625)--Thread(Thread[main,5,main])--Execute query DataModifyQuery(sql="CREATE TABLE ANOTHER (ID INTEGER NOT NULL, BAR INTEGER, FOO VARCHAR(255), CONT_IDENTIFIER INTEGER, PRIMARY KEY (ID))")
[EL Finest]: 2011-06-22 22:54:31.042--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection acquired from connection pool [default].
[EL Fine]: 2011-06-22 22:54:31.042--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--CREATE TABLE ANOTHER (ID INTEGER NOT NULL, BAR INTEGER, FOO VARCHAR(255), CONT_IDENTIFIER INTEGER, PRIMARY KEY (ID))
[EL Finest]: 2011-06-22 22:54:31.159--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection released to connection pool [default].
[EL Finest]: 2011-06-22 22:54:31.159--ServerSession(1832874625)--Thread(Thread[main,5,main])--Execute query DataModifyQuery(sql="ALTER TABLE MANY ADD CONSTRAINT FK_MANY_CONT_IDENTIFIER FOREIGN KEY (CONT_IDENTIFIER) REFERENCES CONTAINER (ID)")
[EL Finest]: 2011-06-22 22:54:31.16--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection acquired from connection pool [default].
[EL Fine]: 2011-06-22 22:54:31.161--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--ALTER TABLE MANY ADD CONSTRAINT FK_MANY_CONT_IDENTIFIER FOREIGN KEY (CONT_IDENTIFIER) REFERENCES CONTAINER (ID)
[EL Finest]: 2011-06-22 22:54:31.307--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection released to connection pool [default].
[EL Finest]: 2011-06-22 22:54:31.308--ServerSession(1832874625)--Thread(Thread[main,5,main])--Execute query DataModifyQuery(sql="ALTER TABLE ANOTHER ADD CONSTRAINT FK_ANOTHER_CONT_IDENTIFIER FOREIGN KEY (CONT_IDENTIFIER) REFERENCES CONTAINER (ID)")
[EL Finest]: 2011-06-22 22:54:31.308--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection acquired from connection pool [default].
[EL Fine]: 2011-06-22 22:54:31.308--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--ALTER TABLE ANOTHER ADD CONSTRAINT FK_ANOTHER_CONT_IDENTIFIER FOREIGN KEY (CONT_IDENTIFIER) REFERENCES CONTAINER (ID)
[EL Finest]: 2011-06-22 22:54:31.437--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection released to connection pool [default].
[EL Finest]: 2011-06-22 22:54:31.438--ServerSession(1832874625)--Thread(Thread[main,5,main])--Execute query DataModifyQuery(sql="CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT DECIMAL(38), PRIMARY KEY (SEQ_NAME))")
[EL Finest]: 2011-06-22 22:54:31.438--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection acquired from connection pool [default].
[EL Fine]: 2011-06-22 22:54:31.438--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT DECIMAL(38), PRIMARY KEY (SEQ_NAME))
[EL Finest]: 2011-06-22 22:54:31.83--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection released to connection pool [default].
[EL Finest]: 2011-06-22 22:54:31.831--ServerSession(1832874625)--Thread(Thread[main,5,main])--Execute query DataModifyQuery(sql="DELETE FROM SEQUENCE WHERE SEQ_NAME = 'SEQ_GEN'")
[EL Finest]: 2011-06-22 22:54:31.833--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection acquired from connection pool [default].
[EL Fine]: 2011-06-22 22:54:31.833--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--DELETE FROM SEQUENCE WHERE SEQ_NAME = SEQ_GEN
[EL Finest]: 2011-06-22 22:54:31.835--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection released to connection pool [default].
[EL Finest]: 2011-06-22 22:54:31.836--ServerSession(1832874625)--Thread(Thread[main,5,main])--Execute query DataReadQuery(sql="SELECT * FROM SEQUENCE WHERE SEQ_NAME = 'SEQ_GEN'")
[EL Finest]: 2011-06-22 22:54:31.836--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection acquired from connection pool [default].
[EL Fine]: 2011-06-22 22:54:31.836--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--SELECT * FROM SEQUENCE WHERE SEQ_NAME = SEQ_GEN
[EL Finest]: 2011-06-22 22:54:31.841--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection released to connection pool [default].
[EL Finest]: 2011-06-22 22:54:31.842--ServerSession(1832874625)--Thread(Thread[main,5,main])--Execute query DataModifyQuery(sql="INSERT INTO SEQUENCE(SEQ_NAME, SEQ_COUNT) values ('SEQ_GEN', 0)")
[EL Finest]: 2011-06-22 22:54:31.842--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection acquired from connection pool [default].
[EL Fine]: 2011-06-22 22:54:31.842--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--INSERT INTO SEQUENCE(SEQ_NAME, SEQ_COUNT) values (SEQ_GEN, 0)
[EL Finest]: 2011-06-22 22:54:31.844--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection released to connection pool [default].
[EL Finer]: 2011-06-22 22:54:31.899--ServerSession(1832874625)--Thread(Thread[main,5,main])--Canonical Metamodel class [org.test.Container_] not found during initialization.
[EL Finer]: 2011-06-22 22:54:31.9--ServerSession(1832874625)--Thread(Thread[main,5,main])--Canonical Metamodel class [org.test.Another_] not found during initialization.
[EL Finer]: 2011-06-22 22:54:31.9--ServerSession(1832874625)--Thread(Thread[main,5,main])--Canonical Metamodel class [org.test.Many_] not found during initialization.
[EL Finer]: 2011-06-22 22:54:31.901--ServerSession(1832874625)--Thread(Thread[main,5,main])--Canonical Metamodel class [org.test.Emb_] not found during initialization.
[EL Finest]: 2011-06-22 22:54:31.901--ServerSession(1832874625)--Thread(Thread[main,5,main])--End deploying Persistence Unit jpabug; session file:/Users/pharriso/eclipse/workspace2/jpabug/target/classes/_jpabug; state Deployed; factoryCount 1
[EL Finer]: 2011-06-22 22:54:31.927--ServerSession(1832874625)--Thread(Thread[main,5,main])--client acquired: 1229893321
[EL Finer]: 2011-06-22 22:54:31.945--ClientSession(1229893321)--Thread(Thread[main,5,main])--acquire unit of work: 1770446243
[EL Finest]: 2011-06-22 22:54:31.945--UnitOfWork(1770446243)--Thread(Thread[main,5,main])--persist() operation called on: org.test.Container@15412e75.
[EL Finest]: 2011-06-22 22:54:31.946--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection acquired from connection pool [default].
[EL Finer]: 2011-06-22 22:54:31.947--ClientSession(1229893321)--Connection(1491344323)--Thread(Thread[main,5,main])--begin transaction
[EL Finest]: 2011-06-22 22:54:31.948--ClientSession(1229893321)--Thread(Thread[main,5,main])--Execute query DataModifyQuery(name="SEQUENCE" sql="UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + #PREALLOC_SIZE WHERE SEQ_NAME = #SEQ_NAME")
[EL Fine]: 2011-06-22 22:54:31.949--ClientSession(1229893321)--Connection(1491344323)--Thread(Thread[main,5,main])--UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?
	bind => [50, SEQ_GEN]
[EL Finest]: 2011-06-22 22:54:31.95--ClientSession(1229893321)--Thread(Thread[main,5,main])--Execute query ValueReadQuery(name="SEQUENCE" sql="SELECT SEQ_COUNT FROM SEQUENCE WHERE SEQ_NAME = #SEQ_NAME")
[EL Fine]: 2011-06-22 22:54:31.951--ClientSession(1229893321)--Connection(1491344323)--Thread(Thread[main,5,main])--SELECT SEQ_COUNT FROM SEQUENCE WHERE SEQ_NAME = ?
	bind => [SEQ_GEN]
[EL Finest]: 2011-06-22 22:54:31.952--ClientSession(1229893321)--Connection(1491344323)--Thread(Thread[main,5,main])--local sequencing preallocation for SEQ_GEN: objects: 50 , first: 1, last: 50
[EL Finer]: 2011-06-22 22:54:31.952--ClientSession(1229893321)--Connection(1491344323)--Thread(Thread[main,5,main])--commit transaction
[EL Finest]: 2011-06-22 22:54:31.954--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--local sequencing preallocation is copied to preallocation after transaction commit
[EL Finest]: 2011-06-22 22:54:31.955--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection released to connection pool [default].
[EL Finest]: 2011-06-22 22:54:31.955--UnitOfWork(1770446243)--Thread(Thread[main,5,main])--assign sequence to the object (1 -> org.test.Container@15412e75)
[EL Finest]: 2011-06-22 22:54:31.957--UnitOfWork(1770446243)--Thread(Thread[main,5,main])--persist() operation called on: org.test.Many@b3e15f7.
[EL Finest]: 2011-06-22 22:54:31.958--UnitOfWork(1770446243)--Thread(Thread[main,5,main])--assign sequence to the object (2 -> org.test.Many@b3e15f7)
[EL Finest]: 2011-06-22 22:54:31.958--UnitOfWork(1770446243)--Thread(Thread[main,5,main])--persist() operation called on: org.test.Many@191410e5.
[EL Finest]: 2011-06-22 22:54:31.958--UnitOfWork(1770446243)--Thread(Thread[main,5,main])--assign sequence to the object (3 -> org.test.Many@191410e5)
[EL Finest]: 2011-06-22 22:54:31.96--UnitOfWork(1770446243)--Thread(Thread[main,5,main])--persist() operation called on: org.test.Another@6d7f11fb.
[EL Finest]: 2011-06-22 22:54:31.961--UnitOfWork(1770446243)--Thread(Thread[main,5,main])--assign sequence to the object (4 -> org.test.Another@6d7f11fb)
[EL Finest]: 2011-06-22 22:54:31.961--UnitOfWork(1770446243)--Thread(Thread[main,5,main])--persist() operation called on: org.test.Another@3175ade6.
[EL Finest]: 2011-06-22 22:54:31.961--UnitOfWork(1770446243)--Thread(Thread[main,5,main])--assign sequence to the object (5 -> org.test.Another@3175ade6)
[EL Finer]: 2011-06-22 22:54:31.961--UnitOfWork(1770446243)--Thread(Thread[main,5,main])--begin unit of work commit
[EL Finest]: 2011-06-22 22:54:31.968--UnitOfWork(1770446243)--Thread(Thread[main,5,main])--Unregister the object org.test.Another@6d7f11fb
[EL Finest]: 2011-06-22 22:54:31.97--UnitOfWork(1770446243)--Thread(Thread[main,5,main])--Unregister the object org.test.Another@3175ade6
[EL Finest]: 2011-06-22 22:54:31.971--UnitOfWork(1770446243)--Thread(Thread[main,5,main])--Execute query InsertObjectQuery(org.test.Container@15412e75)
[EL Finest]: 2011-06-22 22:54:31.974--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection acquired from connection pool [default].
[EL Finer]: 2011-06-22 22:54:31.974--ClientSession(1229893321)--Connection(1491344323)--Thread(Thread[main,5,main])--begin transaction
[EL Fine]: 2011-06-22 22:54:31.977--ClientSession(1229893321)--Connection(1491344323)--Thread(Thread[main,5,main])--INSERT INTO CONTAINER (ID, INCNT, SIMPLE) VALUES (?, ?, ?)
	bind => [1, abc, simple]
[EL Finest]: 2011-06-22 22:54:31.979--UnitOfWork(1770446243)--Thread(Thread[main,5,main])--Execute query InsertObjectQuery(org.test.Many@191410e5)
[EL Fine]: 2011-06-22 22:54:31.979--ClientSession(1229893321)--Connection(1491344323)--Thread(Thread[main,5,main])--INSERT INTO MANY (ID, NAME, OTHER) VALUES (?, ?, ?)
	bind => [3, s2, 2]
[EL Finest]: 2011-06-22 22:54:31.981--UnitOfWork(1770446243)--Thread(Thread[main,5,main])--Execute query InsertObjectQuery(org.test.Many@b3e15f7)
[EL Fine]: 2011-06-22 22:54:31.981--ClientSession(1229893321)--Connection(1491344323)--Thread(Thread[main,5,main])--INSERT INTO MANY (ID, NAME, OTHER) VALUES (?, ?, ?)
	bind => [2, s1, 1]
[EL Finest]: 2011-06-22 22:54:31.983--UnitOfWork(1770446243)--Thread(Thread[main,5,main])--Execute query DataModifyQuery()
[EL Fine]: 2011-06-22 22:54:31.986--ClientSession(1229893321)--Connection(1491344323)--Thread(Thread[main,5,main])--UPDATE MANY SET CONT_IDENTIFIER = ? WHERE (ID = ?)
	bind => [1, 2]
[EL Finest]: 2011-06-22 22:54:31.989--UnitOfWork(1770446243)--Thread(Thread[main,5,main])--Execute query DataModifyQuery(sql="UPDATE MANY SET CONT_IDENTIFIER = ? WHERE (ID = ?)")
[EL Fine]: 2011-06-22 22:54:31.989--ClientSession(1229893321)--Connection(1491344323)--Thread(Thread[main,5,main])--UPDATE MANY SET CONT_IDENTIFIER = ? WHERE (ID = ?)
	bind => [1, 3]
[EL Finest]: 2011-06-22 22:54:31.99--UnitOfWork(1770446243)--Thread(Thread[main,5,main])--Execute query DataModifyQuery()
[EL Fine]: 2011-06-22 22:54:31.991--ClientSession(1229893321)--Connection(1491344323)--Thread(Thread[main,5,main])--UPDATE ANOTHER SET CONT_IDENTIFIER = ? WHERE (ID = ?)
	bind => [1, 4]
[EL Finest]: 2011-06-22 22:54:31.992--UnitOfWork(1770446243)--Thread(Thread[main,5,main])--Execute query DataModifyQuery(sql="UPDATE ANOTHER SET CONT_IDENTIFIER = ? WHERE (ID = ?)")
[EL Fine]: 2011-06-22 22:54:31.992--ClientSession(1229893321)--Connection(1491344323)--Thread(Thread[main,5,main])--UPDATE ANOTHER SET CONT_IDENTIFIER = ? WHERE (ID = ?)
	bind => [1, 5]
[EL Finer]: 2011-06-22 22:54:32.003--ClientSession(1229893321)--Connection(1491344323)--Thread(Thread[main,5,main])--commit transaction
[EL Finest]: 2011-06-22 22:54:32.009--ServerSession(1832874625)--Connection(1491344323)--Thread(Thread[main,5,main])--Connection released to connection pool [default].
[EL Finer]: 2011-06-22 22:54:32.014--UnitOfWork(1770446243)--Thread(Thread[main,5,main])--end unit of work commit
[EL Finer]: 2011-06-22 22:54:32.014--UnitOfWork(1770446243)--Thread(Thread[main,5,main])--resume unit of work
[EL Finer]: 2011-06-22 22:54:32.015--UnitOfWork(1770446243)--Thread(Thread[main,5,main])--release unit of work
[EL Finer]: 2011-06-22 22:54:32.015--ClientSession(1229893321)--Thread(Thread[main,5,main])--client released
Comment 4 Tom Ware CLA 2011-06-23 10:19:24 EDT
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines

Community: Please vote for this bug if it is important to you.  Votes are one of the main criteria we use to determine which bugs to fix next.
Comment 5 Chris Delahunt CLA 2011-06-23 14:44:08 EDT
Created attachment 198487 [details]
simple proposed fix

From the last test case, the problem is due to a fix so that new entities found through relationships marked cascade persist and orphanRemoval=true would be removed if dereferenced.  A simple method signature difference prevented logic from correctly cascading over relationships found in AggregateObjectMapping.

The attached patch resolves the issue in the test case.  I am hesitant to check it in though as it changes the method signature on the MapKeyMapping interface's cascadeDiscoverAndPersistUnregisteredNewObjects method as it is public.  This signature difference  from what was in DatabaseMapping was preventing the method from being overriden correctly in AggregateObjectMapping.
Comment 6 Eclipse Webmaster CLA 2022-06-09 10:05:53 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink