| 
					
						 I think I may have run into a bug. I have an entity mapped with optimistic-lock="all" and one property excluded with optimistic-lock="false". When flush is called, I get an exception that 'ORA-01006: bind variable does not exist'. Looking at the log(see below), I can see that hibernate is attempting to bind an extra parameter. When I set optimistic-lock=true on the property, the problem disappears. Is it correct that you should be able to exclude a property from the optimistic locking check in this way?
  
 
 Hibernate version: 
 
 3.0.1 and 3.0.5
 
 Mapping documents:
 
 <hibernate-mapping>
 
     <class
         name="org.aps.eop.model.manuscript.Manuscript"
         table="MANUSCRIPT"
         schema="MANUSCRIPTS"
         lazy="true"
         dynamic-update="true"
         optimistic-lock="all"
     >
 ......
 
 <property
             name="lastUpdated"
             type="java.util.Date"
             update="true"
             insert="true"
             column="LAST_UPDATED"
             optimistic-lock="false" />
             
     </class>
 
 Name and version of the database you are using:
 
 Oracle 9i
 
 Debug level Hibernate log excerpt:
 
 Hibernate: update MANUSCRIPT set PAGE_CNT=? where MANUSCRIPT_ID=? and accode=? and NEXT_EVENT_NUMBER=? and TRANSFER_CODE is null and MAJOR_STATUS=? and TITLE=? and RECEIVED_DATE=? and REVISED_RECVD is null and NEW_RECVD is null and FIGURE_CNT=? and TABLE_CNT=? and PAGE_CNT=? and COLLABORATION is null and CORRESP_AUTHOR=? and REPRINTS is null and MAJ_STAT_DATE is null and DELETED=? and TESTMS=? and PUBLISH_DATA_ID=? and JOURNAL_ID=? and EDITOR_ID=? and SECTION_ID=?
 DEBUG org.hibernate.jdbc.AbstractBatcher (getPreparedStatement) - preparing statement
 DEBUG org.hibernate.persister.entity.BasicEntityPersister (dehydrate) - Dehydrating entity: [org.aps.eop.model.manuscript.Manuscript#354603]
 DEBUG org.hibernate.type.NullableType (nullSafeSet) - binding '12' to parameter: 1
 DEBUG org.hibernate.type.NullableType (nullSafeSet) - binding '354603' to parameter: 2
 DEBUG org.hibernate.type.NullableType (nullSafeSet) - binding 'CNR802' to parameter: 3
 DEBUG org.hibernate.type.NullableType (nullSafeSet) - binding '50' to parameter: 4
 DEBUG org.hibernate.type.NullableType (nullSafeSet) - binding 'VP' to parameter: 5
 DEBUG org.hibernate.type.NullableType (nullSafeSet) - binding 'Strong resonances in elastic scattering of radioactive $"" sup 21_Na on protons' to parameter: 6
 DEBUG org.hibernate.type.NullableType (nullSafeSet) - binding '2002-01-09 00:00:00' to parameter: 7
 DEBUG org.hibernate.type.NullableType (nullSafeSet) - binding '2' to parameter: 8
 DEBUG org.hibernate.type.NullableType (nullSafeSet) - binding '1' to parameter: 9
 DEBUG org.hibernate.type.NullableType (nullSafeSet) - binding '11' to parameter: 10
 DEBUG org.hibernate.type.NullableType (nullSafeSet) - binding '2' to parameter: 11
 DEBUG org.hibernate.type.NullableType (nullSafeSet) - binding 'false' to parameter: 12
 DEBUG org.hibernate.type.NullableType (nullSafeSet) - binding 'false' to parameter: 13
 DEBUG org.hibernate.type.NullableType (nullSafeSet) - binding '240376' to parameter: 14
 DEBUG org.hibernate.type.NullableType (nullSafeSet) - binding '3' to parameter: 15
 DEBUG org.hibernate.type.NullableType (nullSafeSet) - binding '73' to parameter: 16
 DEBUG org.hibernate.type.NullableType (nullSafeSet) - binding '664' to parameter: 17
 DEBUG org.hibernate.type.NullableType (nullSafeSet) - binding '2003-10-28 08:03:05' to parameter: 18
 DEBUG org.hibernate.jdbc.AbstractBatcher (logClosePreparedStatement) - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
 DEBUG org.hibernate.jdbc.AbstractBatcher (closePreparedStatement) - closing statement
 DEBUG org.hibernate.util.JDBCExceptionReporter (logExceptions) - could not update: [org.aps.eop.model.manuscript.Manuscript#354603] [update MANUSCRIPT set PAGE_CNT=? where MANUSCRIPT_ID=? and accode=? and NEXT_EVENT_NUMBER=? and TRANSFER_CODE is null and MAJOR_STATUS=? and TITLE=? and RECEIVED_DATE=? and REVISED_RECVD is null and NEW_RECVD is null and FIGURE_CNT=? and TABLE_CNT=? and PAGE_CNT=? and COLLABORATION is null and CORRESP_AUTHOR=? and REPRINTS is null and MAJ_STAT_DATE is null and DELETED=? and TESTMS=? and PUBLISH_DATA_ID=? and JOURNAL_ID=? and EDITOR_ID=? and SECTION_ID=?]
 java.sql.SQLException: ORA-01006: bind variable does not exist
 
 	at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
 	at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
 	at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:579)
 	at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1894)
 	at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1094)
 	at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2132)
 	at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:2015)
 	at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2877)
 	at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:608)
 	at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:1976)
 	at org.hibernate.persister.entity.BasicEntityPersister.updateOrInsert(BasicEntityPersister.java:1899)
 	at org.hibernate.persister.entity.BasicEntityPersister.update(BasicEntityPersister.java:2139)
 	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:678)
 	at org.aps.eop.util.BaseIntegrationTestCase.flushSession(BaseIntegrationTestCase.java:240)
 	at org.aps.eop.dao.hibernate.ManuscriptDAOImplTest.testUpdatedManuscript(ManuscriptDAOImplTest.java:150) 
					
  
						
					 |