Can EclipseLink 2.5.2 JPA Use Identity Columns With Oracle12c Database? (Doc ID 2042718.1)

Last updated on OCTOBER 28, 2016

Applies to:

Oracle TopLink - Version 12.1.3.0.0 to 12.2.1.2.0 [Release 12c]
Information in this document applies to any platform.

Symptoms

An EclipseLink application attempts to use an Oracle Identity column in JPA, but is found incompatible with JPA.

If SQL: insert INTO departments (department_name) values (“dept1”) is directly executed, the Identity column can work well.

1. Prepare a departments table to define an Oracle Identity column:

 
Here, if a value is set for id field, it can insert a record successfully.

4. The following exception is encountered and it seems EclipseLink is trying to call a Sequence to get unique value.:


javax.ejb.EJBException: EJB Exception: ; nested exception is:
  Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: ORA-02289: ?????

Error Code: 2289
  at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.unwrapRemoteException(RemoteBusinessIntfProxy.java:117)
  at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:92)
  at com.sun.proxy.$Proxy0.persistDepartments(Unknown Source)
  at servletClient.TestOracleIdentitySessionEJBClient1.main(TestOracleIdentitySessionEJBClient1.java:36)
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: ORA-02289: ?????

Error Code: 2289
  at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:340)
  at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:682)
  at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:558)
  at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:2002)
  at org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:570)
  at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:242)
  at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:228)
  at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:299)
  at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelect(DatasourceCallQueryMechanism.java:281)
  at org.eclipse.persistence.queries.DataReadQuery.executeNonCursor(DataReadQuery.java:197)
  at org.eclipse.persistence.queries.DataReadQuery.executeDatabaseQuery(DataReadQuery.java:152)
  at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:899)
  at org.eclipse.persistence.queries.DataReadQuery.execute(DataReadQuery.java:137)
  at org.eclipse.persistence.internal.sessions.AbstractSession.internalExecuteQuery(AbstractSession.java:3214)
  at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1804)
  at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1786)
  at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1737)
  at org.eclipse.persistence.sequencing.QuerySequence.select(QuerySequence.java:309)
  at org.eclipse.persistence.sequencing.QuerySequence.updateAndSelectSequence(QuerySequence.java:254)
  at org.eclipse.persistence.sequencing.StandardSequence.getGeneratedVector(StandardSequence.java:71)
  at org.eclipse.persistence.sequencing.Sequence.getGeneratedVector(Sequence.java:257)
  at org.eclipse.persistence.internal.sequencing.SequencingManager$Preallocation_NoTransaction_State.getNextValue(SequencingManager.java:664)
  at org.eclipse.persistence.internal.sequencing.SequencingManager.getNextValue(SequencingManager.java:1067)
  at org.eclipse.persistence.internal.sequencing.ClientSessionSequencing.getNextValue(ClientSessionSequencing.java:70)
  at org.eclipse.persistence.internal.descriptors.ObjectBuilder.assignSequenceNumber(ObjectBuilder.java:361)
  at org.eclipse.persistence.internal.descriptors.ObjectBuilder.assignSequenceNumber(ObjectBuilder.java:320)
  at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.assignSequenceNumber(UnitOfWorkImpl.java:486)
  at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerNotRegisteredNewObjectForPersist(UnitOfWorkImpl.java:4290)
  at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.registerNotRegisteredNewObjectForPersist(RepeatableWriteUnitOfWork.java:518)
  at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerNewObjectForPersist(UnitOfWorkImpl.java:4235)
  at org.eclipse.persistence.internal.jpa.EntityManagerImpl.persist(EntityManagerImpl.java:496)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:483)
  at weblogic.persistence.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:110)
  at weblogic.persistence.TransactionalEntityManagerProxyImpl.invoke(TransactionalEntityManagerProxyImpl.java:79)
  at weblogic.persistence.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:91)
  at com.sun.proxy.$Proxy192.persist(Unknown Source)
  at test.model.TestOracleIdentitySessionEJBBean.persistDepartments(TestOracleIdentitySessionEJBBean.java:72)
  at test.model.TestOracleIdentitySessionEJBBean_zdmsee_TestOracleIdentitySessionEJBImpl.__WL_invoke(Unknown Source)
  at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:34)
  at test.model.TestOracleIdentitySessionEJBBean_zdmsee_TestOracleIdentitySessionEJBImpl.persistDepartments(Unknown Source)
  at test.model.TestOracleIdentitySessionEJBBean_zdmsee_TestOracleIdentitySessionEJBImpl_WLSkel.invoke(Unknown Source)
  at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:701)
  at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:231)
  at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:527)
  at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
  at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
  at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:523)
  at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
  at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
  at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
Caused by: java.sql.SQLSyntaxErrorException: ORA-02289: ?????
  at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:466)
  at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:407)
  at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1113)
  at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:546)
  at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:269)
  at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:603)
  at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:234)
  at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:55)
  at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:829)
  at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1049)
  at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1270)
  at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:5010)
  at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:5070)
  at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1677)
  at weblogic.jdbc.wrapper.PreparedStatement.executeQuery(PreparedStatement.java:141)
  at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeSelect(DatabaseAccessor.java:1007)
  at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:642)
  ... 51 more
Process exited with exit code 0. 


Environment
TopLink 12.1.3.0.0
EclipseLink 2.5.2
WLS 12.1.3.0.0

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms