Bug 274585 - testUpdateUsingTempStorageWithParameter failed on Derby 10
Summary: testUpdateUsingTempStorageWithParameter failed on Derby 10
Status: RESOLVED FIXED
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: James Sutherland CLA
QA Contact:
URL:
Whiteboard:
Keywords: test
Depends on:
Blocks:
 
Reported: 2009-04-30 16:10 EDT by Edwin Tang CLA
Modified: 2022-06-09 10:07 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Edwin Tang CLA 2009-04-30 16:10:32 EDT
testUpdateUsingTempStorageWithParameter failed on derby 10

Stack Trace:
============t
Internal Exception: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "NULL" at line 1, column 111. Error Code: 20000 Call: INSERT INTO session.TL_CMP3_EMPLOYEE (EMP_ID, VERSION, ADDR_ID, ROOM_NUM) SELECT t0.EMP_ID, (t0.VERSION + 1), NULL, t1.SALARY FROM CMP3_EMPLOYEE t0, CMP3_SALARY t1 WHERE ((t0.F_NAME = 'testUpdateUsingTempStorage') AND (t1.EMP_ID = t0.EMP_ID)) Query: UpdateAllQuery(referenceClass=Employee sql="DECLARE GLOBAL TEMPORARY TABLE session.TL_CMP3_SALARY (EMP_ID INTEGER, SALARY INTEGER) ON COMMIT DELETE ROWS NOT LOGGED")

Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 1.1.1.qualifier): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "NULL" at line 1, column 111.
Error Code: 20000
Call: INSERT INTO session.TL_CMP3_EMPLOYEE (EMP_ID, VERSION, ADDR_ID, ROOM_NUM) SELECT t0.EMP_ID, (t0.VERSION + 1), NULL, t1.SALARY FROM CMP3_EMPLOYEE t0, CMP3_SALARY t1 WHERE ((t0.F_NAME = 'testUpdateUsingTempStorage') AND (t1.EMP_ID = t0.EMP_ID))
Query: UpdateAllQuery(referenceClass=Employee sql="DECLARE GLOBAL TEMPORARY TABLE session.TL_CMP3_SALARY (EMP_ID INTEGER, SALARY INTEGER) ON COMMIT DELETE ROWS NOT LOGGED")
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:323)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:767)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:833)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:558)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:501)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeCall(AbstractSession.java:872)
at org.eclipse.persistence.internal.sessions.IsolatedClientSession.executeCall(IsolatedClientSession.java:132)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:205)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.updateAllUsingTempTables(DatasourceCallQueryMechanism.java:751)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.updateAll(DatasourceCallQueryMechanism.java:713)
at org.eclipse.persistence.queries.UpdateAllQuery.executeDatabaseQuery(UpdateAllQuery.java:153)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:664)
at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:583)
at org.eclipse.persistence.queries.ModifyAllQuery.executeInUnitOfWork(ModifyAllQuery.java:144)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2755)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1181)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1165)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1139)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeUpdate(EJBQueryImpl.java:424)
at org.eclipse.persistence.testing.tests.jpa.advanced.EntityManagerJUnitTestSuite.internalUpdateUsingTempStorage(EntityManagerJUnitTestSuite.java:5485)
at org.eclipse.persistence.testing.tests.jpa.advanced.EntityManagerJUnitTestSuite.testUpdateUsingTempStorageWithParameter(EntityManagerJUnitTestSuite.java:5440)
at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.runBare(JUnitTestCase.java:359)
Caused by: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "NULL" at line 1, column 111.
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.execute(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown Source)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:756)
Caused by: java.sql.SQLException: Syntax error: Encountered "NULL" at line 1, column 111.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
Caused by: ERROR 42X01: Syntax error: Encountered "NULL" at line 1, column 111.
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at org.apache.derby.impl.sql.compile.ParserImpl.parseStatement(Unknown Source)
at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
Comment 1 Kristian Waagan CLA 2009-05-19 04:04:18 EDT
Using NULL in selects isn't allowed in Derby.
As a workaround, you can use a cast, for instance SELECT myCol, CAST(NULL AS INT) FROM ...

Another option is to request that Derby allows NULL in selects by creating a Jira issue at https://issues.apache.org/jira/browse/DERBY
Comment 2 Yiping Zhao CLA 2009-08-27 11:14:57 EDT
After a further investigation, I found that we need to add database-platform class in sessions.xml for server. Because when the tests are running outside container, we pass in <jvmarg value="${jvmarg.db.platform}"/> in "run-test" target, but we don't pass in db.platform in "server-run-test" target. So following parts need to be added to sessions.xml:

<login xsi:type="database-login">
	<platform-class>org.eclipse.persistence.platform.database.DerbyPlatform</platform-class>
</login>
Comment 3 Yiping Zhao CLA 2009-08-27 14:28:57 EDT
I am sorry that I put comment to the wrong bug, please ignore my previous comments.
Comment 4 James Sutherland CLA 2009-11-16 15:25:34 EST
This should be fixed now.
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:03:43 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 6 Eclipse Webmaster CLA 2022-06-09 10:07:36 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink