-->
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.  [ 3 posts ] 
Author Message
 Post subject: Can't lock records in Oracle 9i Database
PostPosted: Fri Feb 04, 2005 3:31 am 
Newbie

Joined: Mon Sep 20, 2004 11:24 pm
Posts: 2
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
2.1.6
Mapping documents:

<hibernate-mapping package="com.foo.ddo.action">
<!--
Created by the Middlegen Hibernate plugin 2.1
http://boss.bekk.no/boss/middlegen/
http://www.hibernate.org/
$Revision: 1.4 $
-->

<class
name="Action"
table="ACTION"
>
<id
name="id"
type="java.lang.Long"
column="ACTION_ID"
>
<generator class="sequence">
<param name="sequence">ACTION_SQ_ID</param>
</generator>
</id>

<property
name="actionDate"
type="java.util.Date"
column="ACTION_DATE"
/>

<property
name="actionTypeId"
type="java.lang.Long"
column="ACTION_TYPE_ID"
/>

<property
name="fdrCode"
type="java.lang.String"
column="FDR_CODE"
/>

<property
name="fdrKeyId"
type="java.lang.Long"
column="FDR_KEY_ID"
/>

<property
name="requestedByPartyId"
type="java.lang.Long"
column="REQUESTED_BY_PARTY_ID"
/>

<property
name="inputByPartyId"
type="java.lang.Long"
column="INPUT_BY_PARTY_ID"
/>

<property
name="employeeFirstName"
type="string"
column="EMPLOYEE_FIRST_NAME"
/>

<property
name="employeeLastName"
type="string"
column="EMPLOYEE_Last_NAME"
/>

</class>
</hibernate-mapping>



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

/**
* @param questionId
* @return
* @throws MessageException
*/
private UpdateInformation getQuestion(Long questionId)
throws MessageException {
UIRDAO mDao = (UIRDAO) dao;

//check whether the original UIR has been replied.
UpdateInformation question = (UpdateInformation) mDao.findByIdWithLock(
UpdateInformation.class, questionId);
messageService.fillCmName(question);

if (question.isReplied())
throw new MessageException(MessageException.MSG_ALREADY_REPLIED);
return question;
}


/**
* @see com.onefbusa.dao.BaseDAO#findByIdWithLock(java.lang.Class, java.lang.Long)
*/
public Persistent findByIdWithLock(Class c, Long id)
throws DataAccessException {
return (Persistent) hibernateOperations.get(c, id, LockMode.UPGRADE);
}


Full stack trace of any exception that occurs:

java.sql.SQLException: ORA-01002: fetch out of sequence

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:189)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:242)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:554)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1478)
at oracle.jdbc.ttc7.TTC7Protocol.fetch(TTC7Protocol.java:969)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2387)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2660)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:457)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:387)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:205)
at net.sf.hibernate.persister.AbstractEntityPersister.lock(AbstractEntityPersister.java:1198)
at net.sf.hibernate.persister.NormalizedEntityPersister.load(NormalizedEntityPersister.java:407)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2117)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2040)
at net.sf.hibernate.impl.SessionImpl.get(SessionImpl.java:2065)
at org.springframework.orm.hibernate.HibernateTemplate$2.doInHibernate(HibernateTemplate.java:283)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:243)
at org.springframework.orm.hibernate.HibernateTemplate.get(HibernateTemplate.java:281)
at com.foo.dao.HibernateBaseDAO.findByIdWithLock(HibernateBaseDAO.java:82)
at com.foo.biz.fs.agent.message.CSRProcessUIRServiceImpl.getQuestion(CSRProcessUIRServiceImpl.java:290)
at com.foo.biz.fs.agent.message.CSRProcessUIRServiceImpl.acceptUIR(CSRProcessUIRServiceImpl.java:266)


Name and version of the database you are using:

Oracle 9.0.1

The generated SQL (show_sql=true):

select ACTION_ID from ACTION where ACTION_ID =? for update

Debug level Hibernate log excerpt:


2005-02-04 14:37:31,058 DEBUG [org.springframework.aop.interceptor.TraceInterceptor] Entering method CSRProcessUIRServiceImpl.acceptUIR(com.foo.ddo.security.AgentCredential@2a7640[id=<null>], 151000)
2005-02-04 14:37:31,120 DEBUG [net.sf.hibernate.impl.SessionImpl] opened session
2005-02-04 14:37:31,120 DEBUG [net.sf.hibernate.impl.SessionImpl] loading [com.foo.ddo.message.UpdateInformation#151000] in lock mode: UPGRADE
2005-02-04 14:37:31,120 DEBUG [net.sf.hibernate.impl.SessionImpl] attempting to resolve [com.foo.ddo.message.UpdateInformation#151000]
2005-02-04 14:37:31,120 DEBUG [net.sf.hibernate.impl.SessionImpl] object not resolved in any cache [com.foo.ddo.message.UpdateInformation#151000]
2005-02-04 14:37:31,120 DEBUG [net.sf.hibernate.persister.NormalizedEntityPersister] Materializing entity: [com.foo.ddo.message.UpdateInformation#151000]
2005-02-04 14:37:31,136 DEBUG [net.sf.hibernate.impl.BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
2005-02-04 14:37:31,136 DEBUG [net.sf.hibernate.SQL] select updateinfo0_.ACTION_ID as ACTION_ID2_, updateinfo0_.READ_TIMESTAMP as READ_TIM2_2_2_, updateinfo0_.SUBJECT as SUBJECT2_2_, updateinfo0_.MESSAGE_TEXT as MESSAGE_4_2_2_, updateinfo0_.ACCOUNT_ID as ACCOUNT_ID2_2_, updateinfo0_.FROM_PARTY_ID as FROM_PAR6_2_2_, updateinfo0_.TO_PARTY_ID as TO_PARTY7_2_2_, updateinfo0_.MESSAGE_CLASSIFICATION_TYPE_ID as MESSAGE_8_2_2_, updateinfo0_.MESSAGE_STATUS_TYPE_ID as MESSAGE_9_2_2_, updateinfo0_.NEXT_MESSAGE_ACTION_ID as NEXT_ME10_2_2_, updateinfo0_.ADDRESS_1 as ADDRESS_12_2_, updateinfo0_.ADDRESS_2 as ADDRESS_22_2_, updateinfo0_.CITY as CITY2_2_, updateinfo0_.STATE as STATE2_2_, updateinfo0_.ZIP as ZIP2_2_, updateinfo0_.ZIP_4 as ZIP_42_2_, updateinfo0_.EMAIL_ADDRESS as EMAIL_A17_2_2_, updateinfo0_.HOME_PHONE as HOME_PHONE2_2_, updateinfo0_.WORK_PHONE as WORK_PHONE2_2_, updateinfo0_.ORIGINAL_ADDRESS_1 as ORIGINA20_2_2_, updateinfo0_.ORIGINAL_ADDRESS_2 as ORIGINA21_2_2_, updateinfo0_.ORIGINAL_CITY as ORIGINA22_2_2_, updateinfo0_.ORIGINAL_STATE as ORIGINA23_2_2_, updateinfo0_.ORIGINAL_ZIP as ORIGINA24_2_2_, updateinfo0_.ORIGINAL_ZIP_4 as ORIGINA25_2_2_, updateinfo0_.ORIGINAL_EMAIL_ADDRESS as ORIGINA26_2_2_, updateinfo0_.ORIGINAL_HOME_PHONE as ORIGINA27_2_2_, updateinfo0_.ORIGINAL_WORK_PHONE as ORIGINA28_2_2_, updateinfo0__1_.ACTION_DATE as ACTION_D2_0_2_, updateinfo0__1_.ACTION_TYPE_ID as ACTION_T3_0_2_, updateinfo0__1_.FDR_CODE as FDR_CODE0_2_, updateinfo0__1_.FDR_KEY_ID as FDR_KEY_ID0_2_, updateinfo0__1_.REQUESTED_BY_PARTY_ID as REQUESTE6_0_2_, updateinfo0__1_.INPUT_BY_PARTY_ID as INPUT_BY7_0_2_, updateinfo0__1_.EMPLOYEE_FIRST_NAME as EMPLOYEE8_0_2_, updateinfo0__1_.EMPLOYEE_Last_NAME as EMPLOYEE9_0_2_, messagecla1_.MESSAGE_CLASSIFICATION_TYPE_ID as MESSAGE_1_0_, messagecla1_.DESCRIPTION as DESCRIPT2_0_, messagesta2_.MESSAGE_STATUS_TYPE_ID as MESSAGE_1_1_, messagesta2_.DESCRIPTION as DESCRIPT2_1_ from UPDATE_INFORMATION updateinfo0_ inner join ACTION updateinfo0__1_ on updateinfo0_.ACTION_ID=updateinfo0__1_.ACTION_ID left outer join MESSAGE_CLASSIFICATION_TYPE messagecla1_ on updateinfo0_.MESSAGE_CLASSIFICATION_TYPE_ID=messagecla1_.MESSAGE_CLASSIFICATION_TYPE_ID left outer join MESSAGE_STATUS_TYPE messagesta2_ on updateinfo0_.MESSAGE_STATUS_TYPE_ID=messagesta2_.MESSAGE_STATUS_TYPE_ID where updateinfo0_.ACTION_ID=?
2005-02-04 14:37:31,136 DEBUG [net.sf.hibernate.impl.BatcherImpl] preparing statement
2005-02-04 14:37:31,152 DEBUG [net.sf.hibernate.type.LongType] binding '151000' to parameter: 1
2005-02-04 14:37:31,183 DEBUG [net.sf.hibernate.loader.Loader] processing result set
2005-02-04 14:37:31,183 DEBUG [net.sf.hibernate.type.LongType] returning '10' as column: MESSAGE_1_0_
2005-02-04 14:37:31,183 DEBUG [net.sf.hibernate.type.LongType] returning '7' as column: MESSAGE_1_1_
2005-02-04 14:37:31,183 DEBUG [net.sf.hibernate.loader.Loader] result row: 10, 7, 151000
2005-02-04 14:37:31,183 DEBUG [net.sf.hibernate.loader.Loader] Initializing object from ResultSet: 10
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.loader.Loader] Hydrating entity: com.foo.ddo.message.MessageClassificationType#10
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.StringType] returning 'UIR request' as column: DESCRIPT2_0_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.loader.Loader] Initializing object from ResultSet: 7
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.loader.Loader] Hydrating entity: com.foo.ddo.message.MessageStatusType#7
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.StringType] returning 'Update information open' as column: DESCRIPT2_1_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.loader.Loader] Initializing object from ResultSet: 151000
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.loader.Loader] Hydrating entity: com.foo.ddo.message.UpdateInformation#151000
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.TimestampType] returning '2005-02-04 14:37:02' as column: READ_TIM2_2_2_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.StringType] returning 'Update Info' as column: SUBJECT2_2_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.StringType] returning null as column: MESSAGE_4_2_2_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.LongType] returning '174' as column: ACCOUNT_ID2_2_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.LongType] returning '1062' as column: FROM_PAR6_2_2_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.LongType] returning null as column: TO_PARTY7_2_2_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.LongType] returning '10' as column: MESSAGE_8_2_2_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.LongType] returning '7' as column: MESSAGE_9_2_2_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.LongType] returning null as column: NEXT_ME10_2_2_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.StringType] returning '1849 CHURCH STREET' as column: ADDRESS_12_2_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.StringType] returning null as column: ADDRESS_22_2_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.StringType] returning 'CROFTON' as column: CITY2_2_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.StringType] returning 'ID' as column: STATE2_2_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.StringType] returning '14785' as column: ZIP2_2_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.StringType] returning '2134' as column: ZIP_42_2_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.StringType] returning 'GARY@anyPlace.com' as column: EMAIL_A17_2_2_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.StringType] returning '6485713285' as column: HOME_PHONE2_2_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.StringType] returning '6485713286' as column: WORK_PHONE2_2_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.StringType] returning '1849 CHURCH STREET' as column: ORIGINA20_2_2_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.StringType] returning null as column: ORIGINA21_2_2_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.StringType] returning 'CROFTON' as column: ORIGINA22_2_2_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.StringType] returning 'ID' as column: ORIGINA23_2_2_
2005-02-04 14:37:31,198 DEBUG [net.sf.hibernate.type.StringType] returning '14785' as column: ORIGINA24_2_2_
2005-02-04 14:37:31,214 DEBUG [net.sf.hibernate.type.StringType] returning '4563' as column: ORIGINA25_2_2_
2005-02-04 14:37:31,214 DEBUG [net.sf.hibernate.type.StringType] returning 'GARY@anyPlace.com' as column: ORIGINA26_2_2_
2005-02-04 14:37:31,214 DEBUG [net.sf.hibernate.type.StringType] returning '6485713285' as column: ORIGINA27_2_2_
2005-02-04 14:37:31,214 DEBUG [net.sf.hibernate.type.StringType] returning '6485713286' as column: ORIGINA28_2_2_
2005-02-04 14:37:31,214 DEBUG [net.sf.hibernate.type.TimestampType] returning '2005-02-04 14:31:19' as column: ACTION_D2_0_2_
2005-02-04 14:37:31,214 DEBUG [net.sf.hibernate.type.LongType] returning '1' as column: ACTION_T3_0_2_
2005-02-04 14:37:31,214 DEBUG [net.sf.hibernate.type.StringType] returning null as column: FDR_CODE0_2_
2005-02-04 14:37:31,214 DEBUG [net.sf.hibernate.type.LongType] returning null as column: FDR_KEY_ID0_2_
2005-02-04 14:37:31,214 DEBUG [net.sf.hibernate.type.LongType] returning '1062' as column: REQUESTE6_0_2_
2005-02-04 14:37:31,214 DEBUG [net.sf.hibernate.type.LongType] returning '1062' as column: INPUT_BY7_0_2_
2005-02-04 14:37:31,214 DEBUG [net.sf.hibernate.type.StringType] returning null as column: EMPLOYEE8_0_2_
2005-02-04 14:37:31,214 DEBUG [net.sf.hibernate.type.StringType] returning null as column: EMPLOYEE9_0_2_
2005-02-04 14:37:31,214 DEBUG [net.sf.hibernate.loader.Loader] done processing result set (1 rows)
2005-02-04 14:37:31,214 DEBUG [net.sf.hibernate.impl.BatcherImpl] done closing: 0 open PreparedStatements, 0 open ResultSets
2005-02-04 14:37:31,214 DEBUG [net.sf.hibernate.impl.BatcherImpl] closing statement
2005-02-04 14:37:31,214 DEBUG [net.sf.hibernate.loader.Loader] total objects hydrated: 3
2005-02-04 14:37:31,214 DEBUG [net.sf.hibernate.impl.SessionImpl] resolving associations for [com.foo.ddo.message.MessageClassificationType#10]
2005-02-04 14:37:31,214 DEBUG [net.sf.hibernate.impl.SessionImpl] adding entity to second-level cache [com.foo.ddo.message.MessageClassificationType#10]
2005-02-04 14:37:31,214 DEBUG [net.sf.hibernate.cache.ReadOnlyCache] Caching: 10
2005-02-04 14:37:31,214 DEBUG [net.sf.hibernate.impl.SessionImpl] done materializing entity [com.foo.ddo.message.MessageClassificationType#10]
2005-02-04 14:37:31,214 DEBUG [net.sf.hibernate.impl.SessionImpl] resolving associations for [com.foo.ddo.message.MessageStatusType#7]
2005-02-04 14:37:31,214 DEBUG [net.sf.hibernate.impl.SessionImpl] adding entity to second-level cache [com.foo.ddo.message.MessageStatusType#7]
2005-02-04 14:37:31,214 DEBUG [net.sf.hibernate.cache.ReadOnlyCache] Caching: 7
2005-02-04 14:37:31,230 DEBUG [net.sf.hibernate.impl.SessionImpl] done materializing entity [com.foo.ddo.message.MessageStatusType#7]
2005-02-04 14:37:31,230 DEBUG [net.sf.hibernate.impl.SessionImpl] resolving associations for [com.foo.ddo.message.UpdateInformation#151000]
2005-02-04 14:37:31,230 DEBUG [net.sf.hibernate.impl.SessionImpl] loading [com.foo.ddo.message.MessageClassificationType#10]
2005-02-04 14:37:31,230 DEBUG [net.sf.hibernate.impl.SessionImpl] attempting to resolve [com.foo.ddo.message.MessageClassificationType#10]
2005-02-04 14:37:31,230 DEBUG [net.sf.hibernate.impl.SessionImpl] resolved object in session cache [com.foo.ddo.message.MessageClassificationType#10]
2005-02-04 14:37:31,230 DEBUG [net.sf.hibernate.impl.SessionImpl] loading [com.foo.ddo.message.MessageStatusType#7]
2005-02-04 14:37:31,230 DEBUG [net.sf.hibernate.impl.SessionImpl] attempting to resolve [com.foo.ddo.message.MessageStatusType#7]
2005-02-04 14:37:31,230 DEBUG [net.sf.hibernate.impl.SessionImpl] resolved object in session cache [com.foo.ddo.message.MessageStatusType#7]
2005-02-04 14:37:31,230 DEBUG [net.sf.hibernate.impl.BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
2005-02-04 14:37:31,230 DEBUG [net.sf.hibernate.SQL] select updateinfo0_.ACTION_ID as ACTION_ID2_, updateinfo0_.READ_TIMESTAMP as READ_TIM2_2_2_, updateinfo0_.SUBJECT as SUBJECT2_2_, updateinfo0_.MESSAGE_TEXT as MESSAGE_4_2_2_, updateinfo0_.ACCOUNT_ID as ACCOUNT_ID2_2_, updateinfo0_.FROM_PARTY_ID as FROM_PAR6_2_2_, updateinfo0_.TO_PARTY_ID as TO_PARTY7_2_2_, updateinfo0_.MESSAGE_CLASSIFICATION_TYPE_ID as MESSAGE_8_2_2_, updateinfo0_.MESSAGE_STATUS_TYPE_ID as MESSAGE_9_2_2_, updateinfo0_.NEXT_MESSAGE_ACTION_ID as NEXT_ME10_2_2_, updateinfo0_.ADDRESS_1 as ADDRESS_12_2_, updateinfo0_.ADDRESS_2 as ADDRESS_22_2_, updateinfo0_.CITY as CITY2_2_, updateinfo0_.STATE as STATE2_2_, updateinfo0_.ZIP as ZIP2_2_, updateinfo0_.ZIP_4 as ZIP_42_2_, updateinfo0_.EMAIL_ADDRESS as EMAIL_A17_2_2_, updateinfo0_.HOME_PHONE as HOME_PHONE2_2_, updateinfo0_.WORK_PHONE as WORK_PHONE2_2_, updateinfo0_.ORIGINAL_ADDRESS_1 as ORIGINA20_2_2_, updateinfo0_.ORIGINAL_ADDRESS_2 as ORIGINA21_2_2_, updateinfo0_.ORIGINAL_CITY as ORIGINA22_2_2_, updateinfo0_.ORIGINAL_STATE as ORIGINA23_2_2_, updateinfo0_.ORIGINAL_ZIP as ORIGINA24_2_2_, updateinfo0_.ORIGINAL_ZIP_4 as ORIGINA25_2_2_, updateinfo0_.ORIGINAL_EMAIL_ADDRESS as ORIGINA26_2_2_, updateinfo0_.ORIGINAL_HOME_PHONE as ORIGINA27_2_2_, updateinfo0_.ORIGINAL_WORK_PHONE as ORIGINA28_2_2_, updateinfo0__1_.ACTION_DATE as ACTION_D2_0_2_, updateinfo0__1_.ACTION_TYPE_ID as ACTION_T3_0_2_, updateinfo0__1_.FDR_CODE as FDR_CODE0_2_, updateinfo0__1_.FDR_KEY_ID as FDR_KEY_ID0_2_, updateinfo0__1_.REQUESTED_BY_PARTY_ID as REQUESTE6_0_2_, updateinfo0__1_.INPUT_BY_PARTY_ID as INPUT_BY7_0_2_, updateinfo0__1_.EMPLOYEE_FIRST_NAME as EMPLOYEE8_0_2_, updateinfo0__1_.EMPLOYEE_Last_NAME as EMPLOYEE9_0_2_, messagecla1_.MESSAGE_CLASSIFICATION_TYPE_ID as MESSAGE_1_0_, messagecla1_.DESCRIPTION as DESCRIPT2_0_, messagesta2_.MESSAGE_STATUS_TYPE_ID as MESSAGE_1_1_, messagesta2_.DESCRIPTION as DESCRIPT2_1_ from UPDATE_INFORMATION updateinfo0_ inner join ACTION updateinfo0__1_ on updateinfo0_.ACTION_ID=updateinfo0__1_.ACTION_ID left outer join MESSAGE_CLASSIFICATION_TYPE messagecla1_ on updateinfo0_.MESSAGE_CLASSIFICATION_TYPE_ID=messagecla1_.MESSAGE_CLASSIFICATION_TYPE_ID left outer join MESSAGE_STATUS_TYPE messagesta2_ on updateinfo0_.MESSAGE_STATUS_TYPE_ID=messagesta2_.MESSAGE_STATUS_TYPE_ID where updateinfo0_.NEXT_MESSAGE_ACTION_ID=?
2005-02-04 14:37:31,230 DEBUG [net.sf.hibernate.impl.BatcherImpl] preparing statement
2005-02-04 14:37:31,245 DEBUG [net.sf.hibernate.type.LongType] binding '151000' to parameter: 1
2005-02-04 14:37:31,277 DEBUG [net.sf.hibernate.loader.Loader] processing result set
2005-02-04 14:37:31,277 DEBUG [net.sf.hibernate.loader.Loader] done processing result set (0 rows)
2005-02-04 14:37:31,277 DEBUG [net.sf.hibernate.impl.BatcherImpl] done closing: 0 open PreparedStatements, 0 open ResultSets
2005-02-04 14:37:31,277 DEBUG [net.sf.hibernate.impl.BatcherImpl] closing statement
2005-02-04 14:37:31,277 DEBUG [net.sf.hibernate.loader.Loader] total objects hydrated: 0
2005-02-04 14:37:31,277 DEBUG [com.foo.ddo.util.PhoneNumber] Try to set phone number: 6485713285
2005-02-04 14:37:31,277 DEBUG [com.foo.ddo.util.PhoneNumber] Try to set phone number: 6485713286
2005-02-04 14:37:31,277 DEBUG [com.foo.ddo.util.PhoneNumber] Try to set phone number: 6485713285
2005-02-04 14:37:31,292 DEBUG [com.foo.ddo.util.PhoneNumber] Try to set phone number: 6485713286
2005-02-04 14:37:31,292 DEBUG [com.foo.ddo.util.PhoneNumber] Try to set phone number: 6485713285
2005-02-04 14:37:31,292 DEBUG [com.foo.ddo.util.PhoneNumber] Try to set phone number: 6485713286
2005-02-04 14:37:31,292 DEBUG [com.foo.ddo.util.PhoneNumber] Try to set phone number: 6485713285
2005-02-04 14:37:31,292 DEBUG [com.foo.ddo.util.PhoneNumber] Try to set phone number: 6485713286
2005-02-04 14:37:31,292 DEBUG [net.sf.hibernate.impl.SessionImpl] done materializing entity [com.foo.ddo.message.UpdateInformation#151000]
2005-02-04 14:37:31,292 DEBUG [net.sf.hibernate.impl.SessionImpl] initializing non-lazy collections
2005-02-04 14:37:31,292 DEBUG [net.sf.hibernate.persister.AbstractEntityPersister] Locking entity: [com.foo.ddo.message.UpdateInformation#151000]
2005-02-04 14:37:31,292 DEBUG [net.sf.hibernate.impl.BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
2005-02-04 14:37:31,292 DEBUG [net.sf.hibernate.SQL] select ACTION_ID from ACTION where ACTION_ID =? for update
2005-02-04 14:37:31,292 DEBUG [net.sf.hibernate.impl.BatcherImpl] preparing statement
2005-02-04 14:37:31,292 DEBUG [net.sf.hibernate.type.LongType] binding '151000' to parameter: 1
2005-02-04 14:37:31,370 DEBUG [net.sf.hibernate.util.JDBCExceptionReporter] SQL Exception
java.sql.SQLException: ORA-01002: fetch out of sequence

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:189)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:242)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:554)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1478)
at oracle.jdbc.ttc7.TTC7Protocol.fetch(TTC7Protocol.java:969)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2387)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2660)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:457)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:387)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:205)
at net.sf.hibernate.persister.AbstractEntityPersister.lock(AbstractEntityPersister.java:1198)
at net.sf.hibernate.persister.NormalizedEntityPersister.load(NormalizedEntityPersister.java:407)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2117)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2040)
at net.sf.hibernate.impl.SessionImpl.get(SessionImpl.java:2065)
at org.springframework.orm.hibernate.HibernateTemplate$2.doInHibernate(HibernateTemplate.java:283)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:243)
at org.springframework.orm.hibernate.HibernateTemplate.get(HibernateTemplate.java:281)
at com.foo.dao.HibernateBaseDAO.findByIdWithLock(HibernateBaseDAO.java:82)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 24, 2005 6:52 am 
Newbie

Joined: Thu Mar 24, 2005 6:32 am
Posts: 4
Hallo,

i am not a db guy, rather spent a time fiddling with database locks
just a few days ago. According oracle doc, there are 2 kinds of locks:
shared and exclusive. This corresponds with LockMode.READ and WRITE
in Hibernate vocabulary. Hibernate performs SELECT statement
in order to create READ lock on a record.
However (as far i understood from oracle doc), simple SELECT
does not create shared lock on record! You have to execute

LOCK TABLE tblname IN ROW SHARE MODE
SELECT * FROM tblname WHERE .......

Maybe, this is answer to problems You faced.
Can someone justify this topic?

bye martin


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 24, 2005 7:17 am 
Newbie

Joined: Mon Sep 20, 2004 11:24 pm
Posts: 2
Thanks martin,

I finally solved the problem with the optimistic version support in Hibernate. Luckily the customer approved my DB change request to add a "optimistic_lock_version" column in the table.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.