Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Insert row with @SequenceGenerator ID fails(I have an entity with an primary key that use a sequence generator to generate new keys. I use EclipseLink 1.2 and Oracle 11.2g(11.2.0.1.0).)
Insert row with @SequenceGenerator ID fails [message #526231] Fri, 09 April 2010 05:57 Go to next message
NoName  is currently offline NoName
Messages: 4
Registered: April 2010
Junior Member
I get an exception because a call to 'CALL IDENTITY()' is done during the 'flush' call to the entitymanager. There is no 'IDENTITY' procedure in my Oracle database and I don't now why EclipseLink makes this call. Below is my annotations in the entity class shown:

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SLN_SPRAAK_ID_GENERATOR")
@SequenceGenerator(name = "SLN_SPRAAK_ID_GENERATOR", sequenceName = "SLN_SPRA_SEQ1", allocationSize = 1)
private Long id;

If I run the SQL below it returns correct result so the sequence should be correct.

select sln_spra_seq1.nextval from dual

Stack trace of exception is shown below:

Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 1.2.0.v2
0091016-r5565): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: ORA-06576: ikke et gyldig funksjons-
eller prosedyrenavn

Error Code: 6576
Call: CALL IDENTITY()
Query: ValueReadQuery(sql="CALL IDENTITY()")
at org.eclipse.persistence.exceptions.DatabaseException.sqlExce ption(Dat
abaseException.java:333)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.basi
cExecuteCall(DatabaseAccessor.java:685)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.exec
uteCall(DatabaseAccessor.java:528)
at org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteCall
(AbstractSession.java:914)
at org.eclipse.persistence.internal.queries.DatasourceCallQuery Mechanism
.executeCall(DatasourceCallQueryMechanism.java:205)
at org.eclipse.persistence.internal.queries.DatasourceCallQuery Mechanism
.executeCall(DatasourceCallQueryMechanism.java:191)
at org.eclipse.persistence.internal.queries.DatasourceCallQuery Mechanism
.executeSelectCall(DatasourceCallQueryMechanism.java:262)
at org.eclipse.persistence.internal.queries.DatasourceCallQuery Mechanism
.executeSelect(DatasourceCallQueryMechanism.java:244)
at org.eclipse.persistence.queries.DataReadQuery.executeNonCurs or(DataRe
adQuery.java:188)
at org.eclipse.persistence.queries.DataReadQuery.executeDatabas eQuery(Da
taReadQuery.java:144)
at org.eclipse.persistence.queries.DatabaseQuery.execute(Databa seQuery.j
ava:670)
at org.eclipse.persistence.queries.DataReadQuery.execute(DataRe adQuery.j
ava:130)
at org.eclipse.persistence.internal.sessions.AbstractSession.in ternalExe
cuteQuery(AbstractSession.java:2322)
at org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteQuer
y(AbstractSession.java:1225)
at org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteQuer
y(AbstractSession.java:1207)
at org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteQuer
y(AbstractSession.java:1167)
at org.eclipse.persistence.sequencing.QuerySequence.select(Quer ySequence
.java:300)
at org.eclipse.persistence.sequencing.QuerySequence.updateAndSe lectSeque
nce(QuerySequence.java:246)
at org.eclipse.persistence.sequencing.StandardSequence.getGener atedValue
(StandardSequence.java:61)
at org.eclipse.persistence.sequencing.Sequence.getGeneratedValu e(Sequenc
e.java:219)
at org.eclipse.persistence.internal.sequencing.SequencingManage r$NoPreal
location_State.getNextValue(SequencingManager.java:683)
at org.eclipse.persistence.internal.sequencing.SequencingManage r.getNext
Value(SequencingManager.java:961)
at org.eclipse.persistence.internal.sequencing.ClientSessionSeq uencing.g
etNextValue(ClientSessionSequencing.java:70)
at org.eclipse.persistence.internal.descriptors.ObjectBuilder.a ssignSequ
enceNumber(ObjectBuilder.java:281)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechan ism.updat
eObjectAndRowWithSequenceNumber(DatabaseQueryMechanism.java: 916)
at org.eclipse.persistence.internal.queries.DatasourceCallQuery Mechanism
.insertObject(DatasourceCallQueryMechanism.java:335)
at org.eclipse.persistence.internal.queries.StatementQueryMecha nism.inse
rtObject(StatementQueryMechanism.java:162)
at org.eclipse.persistence.internal.queries.StatementQueryMecha nism.inse
rtObject(StatementQueryMechanism.java:177)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechan ism.inser
tObjectForWrite(DatabaseQueryMechanism.java:461)
at org.eclipse.persistence.queries.InsertObjectQuery.executeCom mit(Inser
tObjectQuery.java:80)
at org.eclipse.persistence.queries.InsertObjectQuery.executeCom mitWithCh
angeSet(InsertObjectQuery.java:90)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechan ism.execu
teWriteWithChangeSet(DatabaseQueryMechanism.java:286)
at org.eclipse.persistence.queries.WriteObjectQuery.executeData baseQuery
(WriteObjectQuery.java:58)
at org.eclipse.persistence.queries.DatabaseQuery.execute(Databa seQuery.j
ava:670)
at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitO fWork(Dat
abaseQuery.java:589)
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.execu teInUnitO
fWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:109)
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.execu teInUnitO
fWork(ObjectLevelModifyQuery.java:86)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.int ernalExec
uteQuery(UnitOfWorkImpl.java:2858)
at org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteQuer
y(AbstractSession.java:1225)
at org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteQuer
y(AbstractSession.java:1207)
at org.eclipse.persistence.internal.sessions.AbstractSession.ex ecuteQuer
y(AbstractSession.java:1167)
at org.eclipse.persistence.internal.sessions.CommitManager.comm itNewObje
ctsForClassWithChangeSet(CommitManager.java:197)
at org.eclipse.persistence.internal.sessions.CommitManager.comm itAllObje
ctsWithChangeSet(CommitManager.java:103)
at org.eclipse.persistence.internal.sessions.AbstractSession.wr iteAllObj
ectsWithChangeSet(AbstractSession.java:3260)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.com mitToData
base(UnitOfWorkImpl.java:1400)
at org.eclipse.persistence.internal.sessions.RepeatableWriteUni tOfWork.c
ommitToDatabase(RepeatableWriteUnitOfWork.java:521)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.com mitToData
baseWithPreBuiltChangeSet(UnitOfWorkImpl.java:1546)
at org.eclipse.persistence.internal.sessions.RepeatableWriteUni tOfWork.w
riteChanges(RepeatableWriteUnitOfWork.java:360)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush (EntityMa
nagerImpl.java:609)
... 88 more
Caused by: java.sql.SQLException: ORA-06576: ikke et gyldig funksjons- eller pro
sedyrenavn

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseE rror.java
:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331 )
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288 )
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedS tatement.
java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPr eparedSta
tement.java:966)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(Orac leStateme
nt.java:1170)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(O raclePrep
aredStatement.java:3339)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(Orac lePrepare
dStatement.java:3384)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.exec
uteSelect(DatabaseAccessor.java:890)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.basi
cExecuteCall(DatabaseAccessor.java:600)

Stack trace

[Updated on: Fri, 09 April 2010 07:27]

Report message to a moderator

Re: Insert row with @SequenceGenerator ID fails [message #526251 is a reply to message #526231] Fri, 09 April 2010 07:31 Go to previous message
NoName  is currently offline NoName
Messages: 4
Registered: April 2010
Junior Member
After 3 days we now found the cause for this error. It was caused by having set wrong database vendor in jetty-applicationContext.xml file. we had forgotton that this file overrides persistence.xml. The failure was in the section below where databasePlatform was set incorrect:

<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean ">
<property name="persistenceUnitName" value="TestAvJPA" />
<property name="jpaVendorAdapter">
<bean class=" org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapt er ">
<property name="showSql" value="true" />
<property name="generateDdl" value="false" />
<property name="databasePlatform" value=" org.eclipse.persistence.platform.database.oracle.Oracle11Pla tform " />
</bean>
</property>
</bean>
Previous Topic:New with JPA
Next Topic:EclipseLink 2 ignoring my annotations!
Goto Forum:
  


Current Time: Mon Jul 28 20:38:39 EDT 2014

Powered by FUDForum. Page generated in 0.02253 seconds