-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: SQLException: Invalid column index when optimistic-lock=&quo
PostPosted: Thu Aug 25, 2005 9:27 am 
Newbie

Joined: Fri Apr 08, 2005 6:28 pm
Posts: 17
Location: US
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.0.5

Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"
>

<hibernate-mapping package="com.lucent.ic.framework.data" >
<class name="Mo" table="MO" dynamic-update="true" >
<id
column="MOOID"
name="moOid"
type="java.lang.Long"
length="12"
>
<generator class="sequence"><param name="sequence">MoOid</param></generator>
</id>
<discriminator column="moType" type="string" length="23" insert="false" />

<natural-id>
<property
column="moName"
length="200"
name="moName"
not-null="true"
type="string"
/>
</natural-id>

<timestamp
name="lastUpdate"
column="lastUpdate"
/>
<property
column="deletionInd"
optimistic-lock="false"
length="1"
name="deletionInd"
not-null="false"
type="boolean"
/>
<property
column="lockedInd"
length="1"
name="lockedInd"
not-null="false"
type="boolean"
/>
<!-- The rest is omitted -->

</class>
</hibernate-mapping>



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.lucent.ic.framework.data.mot">
<subclass name="MotAP_DS1" extends="com.lucent.ic.framework.data.Mo"
discriminator-value="AP_DS1" dynamic-update="true" batch-size="500">
<join table="MOT_AP_DS1" fetch="select">
<key column="moOid"/>
<!-- the rest is omitted -->
</join>
</subclass>
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
3601447 2005-08-24 23:05:53,142: [pool-1-thread-2] DEBUG org.hibernate.util.JDBCExceptionReporter:63 - could not update: [com.lucent.ic.framework.data.mot.MotAP_DS1#24951]; Object: { [ Mo: com.lucent.ic.framework.data.mot.MotAP_DS1@dba04f33: MoOid: 24951; MoType: AP_DS1; MoName: /System:SysId=10/ECP:ECPId=1/AP:APId=11/AP_DS1:DS1Id=1]; ; Mot attributes: {DS1Id=1, protocol=LAPD, link_spd=null, APId=11, boardtype=INTER, custom1=null, custom4=null, status=e, custom3=null, custom5=null, custom2=null, framing_mode=esf, ECPId=1, rsvd1_tdma=null, SysId=10, line_coding=b8zs, line_rate=t1} } [/* update com.lucent.ic.framework.data.mot.MotAP_DS1 */ update MO set deletionInd=? where MOOID=?]
java.sql.SQLException: Invalid column index
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227)
at oracle.jdbc.driver.OraclePreparedStatement.setTimestampInternal(OraclePreparedStatement.java:6272)
at oracle.jdbc.driver.OraclePreparedStatement.setTimestamp(OraclePreparedStatement.java:6247)
at org.hibernate.type.TimestampType.set(TimestampType.java:43)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:62)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:44)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:1993)
at org.hibernate.persister.entity.BasicEntityPersister.updateOrInsert(BasicEntityPersister.java:1935)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:2189)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:75)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:137)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
at com.lucent.ic.framework.data.base._BaseRootDAO.flushAndClearSession(_BaseRootDAO.java:719)
at com.lucent.ic.framework.data.dao.MotDAOImpl.flushAndClearSession(MotDAOImpl.java:316)
at com.lucent.ic.framework.data.base._BaseRootDAO.flushAndClerSession(_BaseRootDAO.java:708)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:288)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:155)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:122)
at org.springframework.orm.hibernate3.HibernateInterceptor.invoke(HibernateInterceptor.java:163)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174)
at $Proxy9.flushAndClerSession(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:288)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:155)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:122)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:57)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174)
at $Proxy10.flushAndClerSession(Unknown Source)
at com.lucent.ic.framework.adapters.manager.GenericDataAdapter.processFile(GenericDataAdapter.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:288)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:155)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:122)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:57)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174)
at $Proxy24.processFile(Unknown Source)
at com.lucent.ic.framework.adapters.manager.GenericAdapter$DaExecutor.call(GenericAdapter.java:291)
at com.lucent.ic.framework.adapters.manager.GenericAdapter$DaExecutor.call(GenericAdapter.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
at java.util.concurrent.FutureTask.run(FutureTask.java:123)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
3601494 2005-08-24 23:05:53,189: [pool-1-thread-2] WARN org.hibernate.util.JDBCExceptionReporter:71 - SQL Error: 17003, SQLState: null
3601494 2005-08-24 23:05:53,189: [pool-1-thread-2] ERROR org.hibernate.util.JDBCExceptionReporter:72 - Invalid column index
3601603 2005-08-24 23:05:53,298: [pool-1-thread-2] ERROR org.hibernate.persister.entity.BasicEntityPersister:2036 - Failed to update:
org.hibernate.exception.GenericJDBCException: could not update: [com.lucent.ic.framework.data.mot.MotAP_DS1#24951]; Object: { [ Mo: com.lucent.ic.framework.data.mot.MotAP_DS1@dba04f33: MoOid: 24951; MoType: AP_DS1; MoName: /System:SysId=10/ECP:ECPId=1/AP:APId=11/AP_DS1:DS1Id=1]; ; Mot attributes: {DS1Id=1, protocol=LAPD, link_spd=null, APId=11, boardtype=INTER, custom1=null, custom4=null, status=e, custom3=null, custom5=null, custom2=null, framing_mode=esf, ECPId=1, rsvd1_tdma=null, SysId=10, line_coding=b8zs, line_rate=t1} }
at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:2026)
at org.hibernate.persister.entity.BasicEntityPersister.updateOrInsert(BasicEntityPersister.java:1935)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:2189)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:75)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:137)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
at com.lucent.ic.framework.data.base._BaseRootDAO.flushAndClearSession(_BaseRootDAO.java:719)
at com.lucent.ic.framework.data.dao.MotDAOImpl.flushAndClearSession(MotDAOImpl.java:316)
at com.lucent.ic.framework.data.base._BaseRootDAO.flushAndClerSession(_BaseRootDAO.java:708)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:288)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:155)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:122)
at org.springframework.orm.hibernate3.HibernateInterceptor.invoke(HibernateInterceptor.java:163)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174)
at $Proxy9.flushAndClerSession(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:288)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:155)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:122)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:57)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174)
at $Proxy10.flushAndClerSession(Unknown Source)
at com.lucent.ic.framework.adapters.manager.GenericDataAdapter.processFile(GenericDataAdapter.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:288)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:155)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:122)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:57)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174)
at $Proxy24.processFile(Unknown Source)
at com.lucent.ic.framework.adapters.manager.GenericAdapter$DaExecutor.call(GenericAdapter.java:291)
at com.lucent.ic.framework.adapters.manager.GenericAdapter$DaExecutor.call(GenericAdapter.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
at java.util.concurrent.FutureTask.run(FutureTask.java:123)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.sql.SQLException: Invalid column index
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227)
at oracle.jdbc.driver.OraclePreparedStatement.setTimestampInternal(OraclePreparedStatement.java:6272)
at oracle.jdbc.driver.OraclePreparedStatement.setTimestamp(OraclePreparedStatement.java:6247)
at org.hibernate.type.TimestampType.set(TimestampType.java:43)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:62)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:44)
at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:1993)
... 53 more

Name and version of the database you are using:
Oracle 9.2

The generated SQL (show_sql=true):
update MO set deletionInd=? where MOOID=?

Debug level Hibernate log excerpt:


Neither of the variables referenced in the generated SQL statement has type TIMESTAMP, however Hibernate is calling OraclePreparedStatement.setTimestamp ()

Thanks in advance,
Dmitri


Top
 Profile  
 
 Post subject: timestamp
PostPosted: Thu Aug 25, 2005 11:17 am 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
mapping file defines
Quote:
<timestamp
name="lastUpdate"
column="lastUpdate"
/>

and therefore H uses the lastUpdate column for optimistic locking
http://www.hibernate.org/hib_docs/v3/re ... pping.html

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject: Re: timestamp
PostPosted: Thu Aug 25, 2005 11:22 am 
Newbie

Joined: Fri Apr 08, 2005 6:28 pm
Posts: 17
Location: US
kgignatyev wrote:
mapping file defines
Quote:
<timestamp
name="lastUpdate"
column="lastUpdate"
/>

and therefore H uses the lastUpdate column for optimistic locking
http://www.hibernate.org/hib_docs/v3/re ... pping.html



According to documentation optimistic-lock="false" disables optimistic locking (and therefore increment of lastUpdate) for particular attribute.

The problem is that Hibernate does not handle optimistic-lock="false" correctly. It generates SQL statement without lastUpdate (as expected), but calls PreparedStatement.setTimestamp() for it. This results in SQLException


Top
 Profile  
 
 Post subject: hmm
PostPosted: Thu Aug 25, 2005 11:30 am 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
I see now.
Looks like bug to me.

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject: Re: hmm
PostPosted: Thu Aug 25, 2005 11:32 am 
Newbie

Joined: Fri Apr 08, 2005 6:28 pm
Posts: 17
Location: US
kgignatyev wrote:
I see now.
Looks like bug to me.


Spasibo.

I will wait to see if somebody from Hibernate team confirms that before submitting bug report.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.