Bug 317197

Summary: WDF Tests: org.eclipse.persistence.testing.tests.wdf.jpa1.foreignkeys.TestForeignKeys.testInheritance failed on both javaSE and javaEE
Product: z_Archived Reporter: Kevin Yuan <kevin.yuan>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: adrian.goerler, andreas.fischbach, christopher.delahunt, eclipselink.orm-inbox, sabine.heider, tom.ware
Version: unspecifiedKeywords: test
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 317597    
Bug Blocks:    
Attachments:
Description Flags
work around until original issue is solved
none
additional patch fixing issue on Oracle
none
additional patch fixing tests on Oracle, SQL Server and MaxDB
none
patch for tests in 2.1 none

Description Kevin Yuan CLA 2010-06-17 11:11:03 EDT
This test failed with "table or view does not exist", table "TMP_VEHICLE_PROFILE" seems not to be created successfully. The following are stack trace:

Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.0.v20100616-r7618): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'eclipselink3.TMP_VEHICLE_PROFILE' doesn't exist Error Code: 1146 Call: DELETE FROM TMP_VEHICLE_PROFILE WHERE (VEHICLE_ID = ?) bind => [1] Query: DataModifyQuery(sql="DELETE FROM TMP_VEHICLE_PROFILE WHERE (VEHICLE_ID = ?)")

javax.persistence.RollbackException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.0.v20100616-r7618): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'eclipselink3.TMP_VEHICLE_PROFILE' doesn't exist
Error Code: 1146
Call: DELETE FROM TMP_VEHICLE_PROFILE WHERE (VEHICLE_ID = ?)
bind => [1]
Query: DataModifyQuery(sql="DELETE FROM TMP_VEHICLE_PROFILE WHERE (VEHICLE_ID = ?)")
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.eclipse.persistence.testing.tests.wdf.jpa1.foreignkeys.TestForeignKeys.testInheritance(TestForeignKeys.java:456)
at org.eclipse.persistence.testing.framework.wdf.SkipBugzillaTestRunner.runChild(SkipBugzillaTestRunner.java:176)
at org.eclipse.persistence.testing.framework.wdf.SkipBugzillaTestRunner.runChild(SkipBugzillaTestRunner.java:37)
at org.eclipse.persistence.testing.framework.wdf.SkipBugzillaTestRunner.run(SkipBugzillaTestRunner.java:49)
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.0.v20100616-r7618): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'eclipselink3.TMP_VEHICLE_PROFILE' doesn't exist
Error Code: 1146

This test failed on both MySQL and Oracle, haven't tried to run on other database yet.
Comment 1 Tom Ware CLA 2010-06-18 12:42:16 EDT
Setting initial target and priority.  Please feel free to change either of these values when you know what the target is.
Comment 2 Tom Ware CLA 2010-06-18 12:42:57 EDT
Setting target and priority.
Comment 3 Adrian Goerler CLA 2010-06-21 10:09:31 EDT
The issue firstly occured after the change 7598: bug 303514.

However, I assume that change 7598 did not introduce this issue but merely makes it visible:

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.

In the test suite, the relationship in question is not used. Hence, it was not noticed that the table "TMP_VEHICLE_PROFILE" is not created. However, change 5798 fixes the issue reported by bug 303514: "ManyToMany JoinTable record is not being deleted when the mapping is inherited. Now, it is correctly atempted to deleted join table records in the table "TMP_VEHICLE_PROFILE" which EclipseLink failed to create. Hence the error reported here occurs.
Comment 4 Adrian Goerler CLA 2010-07-13 12:47:53 EDT
Created attachment 174173 [details]
work around until original issue is solved

Until the cause of this issue (317448: BINARY column not properly created by forward mapper) is solved I am proposing the following work around:

Specify the column definition for MySQL. (This will work on MySQL only.)

In the test model, I had to make the relationship Employee.automobile transient as EclipseLink does not like cyclic foreign keys constraints.
Comment 5 Adrian Goerler CLA 2010-07-14 02:33:47 EDT
workaround checked in in trunk at rev # 7814
Comment 6 Adrian Goerler CLA 2010-07-15 15:31:51 EDT
Created attachment 174439 [details]
additional patch fixing issue on Oracle

The patch introduces a dscriptor customizer allowing to adjust the columnDefiniton for BINARY columns in a database-specific way.
Comment 7 Adrian Goerler CLA 2010-07-15 15:32:25 EDT
Reopened due to the issue on Oracle.
Comment 8 Adrian Goerler CLA 2010-07-16 12:16:51 EDT
Created attachment 174513 [details]
additional patch fixing tests on Oracle, SQL Server and MaxDB

This patch uses a descriptor customizer to allow mapping byte[] to BINARY columns and char[] arrays to VARCHAR columns in a database specific way.

The patch is kind of lengthy as I hit organize imports on the project ;-).

Tested on the following platforms:

MySQL: OK (822 tests)
Oracle: OK (820 tests)
SQL Server: OK (818 tests)
MaxDB: OK (815 tests)
Comment 9 Adrian Goerler CLA 2010-07-16 12:37:30 EDT
https://bugs.eclipse.org/bugs/attachment.cgi?id=174513&action=edit

Checked in at 7843
Comment 10 Sabine Heider CLA 2010-07-29 07:47:39 EDT
Apparently, the same problem exists in 2.1.1.
Comment 11 Chris Delahunt CLA 2010-08-16 13:59:18 EDT
Created attachment 176709 [details]
patch for tests in 2.1
Comment 12 Chris Delahunt CLA 2010-08-16 14:16:44 EDT
fix checked into 2.1.1
Comment 13 Eclipse Webmaster CLA 2022-06-09 10:34:53 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink