Community
Participate
Working Groups
In the test model "jpa1testmodel" of the test suite eclipselink.jpa.wdf.test, there is an entity org.eclipse.persistence.testing.models.wdf.jpa1.employee.Vehicle. Vehicle has a many-to-many relationship with the entity org.eclipse.persistence.testing.models.wdf.jpa1.employee.TravelProfile. This relationship is mapped through a join table "TMP_VEHICLE_PROFILE". EclipseLink's forward mapper fails to create this join table.
I just tried your model classes (Vehicle and TravelProfile) in our DDL test model and observed the following table creation: CREATE TABLE TMP_VEHICLE_PROFILE (VEHICLE_ID NUMBER(5) NOT NULL, PROFILE_ID BLOB NOT NULL, PRIMARY KEY (VEHICLE_ID, PROFILE_ID)) My persistence.xml has the following properties: <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/> <property name="eclipselink.ddl-generation.output-mode" value="both"/> <property name="eclipselink.create-ddl-jdbc-file-name" value="createDDL_ddlGeneration.jdbc"/> <property name="eclipselink.drop-ddl-jdbc-file-name" value="dropDDL_ddlGeneration.jdbc"/> Am I missing something?
The CREATE TABLE statement created by the forward mapper can't be executed on MySQL: Call: DROP TABLE TMP_VEHICLE_PROFILE Query: DataModifyQuery(sql="DROP TABLE TMP_VEHICLE_PROFILE") [EL Finest]: 2010-07-08 13:07:30.937--ServerSession(33219526)--Thread(Thread[main,5,main])--Execute query DataModifyQuery(sql="CREATE TABLE TMP_VEHICLE_PROFILE (PROFILE_ID LONGBLOB NOT NULL, VEHICLE_ID SMALLINT NOT NULL, PRIMARY KEY (PROFILE_ID, VEHICLE_ID))") [EL Fine]: 2010-07-08 13:07:30.937--ServerSession(33219526)--Connection(1309073)--Thread(Thread[main,5,main])--CREATE TABLE TMP_VEHICLE_PROFILE (PROFILE_ID LONGBLOB NOT NULL, VEHICLE_ID SMALLINT NOT NULL, PRIMARY KEY (PROFILE_ID, VEHICLE_ID)) [EL Fine]: 2010-07-08 13:07:30.937--ServerSession(33219526)--Thread(Thread[main,5,main])--SELECT 1 [EL Warning]: 2010-07-08 13:07:30.937--ServerSession(33219526)--Thread(Thread[main,5,main])--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.0.qualifier): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: BLOB/TEXT column 'PROFILE_ID' used in key specification without a key length The reason is that EclipseLink chooses "LONGBLOB" as the column type. The the id "guid" of the related entity TravelProfile, from which the column type in the join table is derived, is annotated as follows: @Id @Column(length = 16) public byte[] getGuid() { return guid; } As this attribute is not anntotated with @Lob, a column with BINARY or VARBINARY type should be created instead.
Ok, I understand now. Is this bug not a duplicate of 317597 then? Also 317597 is currently targetted for 2.2 and this one for 2.1.1. I think this should be closed as a duplicate of 317597 since it is just another side of effect of bug 317597. Agree?
(In reply to comment #3) > Ok, I understand now. Is this bug not a duplicate of 317597 then? > > Also 317597 is currently targetted for 2.2 and this one for 2.1.1. I think this > should be closed as a duplicate of 317597 since it is just another side of > effect of bug 317597. > > Agree? Agree. *** This bug has been marked as a duplicate of bug 317597 ***
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink