| 
					
						 Hi,
 I am using Hibernate 3.0.5 with Spring (Version: 1.2.4)
 
 I am setting the TCN (version field) of a VO to a number less than what it is in DB for that row. And I am expecting "StaleObjectStateException" while updating this VO. 
 But somehow Hibernate seems to be ignoring this new TCN, and is successfully updating the VO, and DB shows next TCN value for this VO.
 
 Is there any setting to enable this option? 
 I might be doing something stupid. Please help. (look at lines in bold)
 Here is code snippet:
 
 ********************************************************
       Estimate estimate = docDao.findEstimateByEstimateDocId(estimateDocId);
         if (estimate == null)
             throw new DaoException(
                     "There is no estimate associated with the estimateDocId!");
 
         EstimateXmlAnnotation xmlAnnotation = estimate
                 .getEstimateXmlAnnotation();
         if (xmlAnnotation == null)
             throw new DaoException(
                     "There is no annotation associated with the estimate!");
 
         xmlAnnotation.setXmlData(xmlData); // input from client          
         xmlAnnotation.setUpdatedBy(updatedBy); //inputs from client         
         xmlAnnotation.setUpdatedDate(new Date());
         xmlAnnotation.setCoCd(companyCode);
         logger.info("Tcn passed by client is :" + tcn);
         xmlAnnotation.setTcn(tcn);        //explicitly setting TCN
          Document xmlAnnotationDoc = xmlAnnotation.getDocument();
         xmlAnnotationDoc.setUpdatedBy(updatedBy);
         xmlAnnotationDoc.setUpdatedDate(new Date());
         xmlAnnotationDoc.setCoCd(companyCode);
 
         docDao.update(xmlAnnotationDoc);
         xmlAnnotationDao.update(xmlAnnotation);        
         xmlAnnotationDao.flushHibernateSession();********************************************************
 
 Here is mapping for the EstimateXmlAnnotation  VO:
 
 <hibernate-mapping schema="CLM" package="com.mitchell.services.technical.partialloss.estimate.bo">
 	<class
 		name="EstimateXmlAnnotation"
 		table="CLM_EST_XML_ANNOTATION"
 	>
 		<id
 			name="id"
 			type="java.lang.Long"
 			column="ANNOTATION_ID"
 		>
 			<generator class="sequence">
 				<param name="sequence">CLM_EST_XML_ANNOTATION_SEQ</param>
 			</generator>			
 		</id>
 
 		<version name="tcn" column="TCN" type="java.lang.Long" unsaved-value="null"/>
 
 		<property
 			name="coCd"
 			column="CO_CD"
 			type="string"
 			not-null="true"
 			length="10"
 		/>
 ----so on and so forth..
 ******************************************************
 This is the hibernate log I see (if this helps) 
 
 ******************
 17:12:13,603 DEBUG BasicEntityPersister:2595 - com.mitchell.services.technical.partialloss.estimate.bo.EstimateXmlAnnotation.tcn is dirty
 17:12:13,603 DEBUG BasicEntityPersister:2595 - com.mitchell.services.technical.partialloss.estimate.bo.EstimateXmlAnnotation.updatedDate is dirty
 17:12:13,603 DEBUG DefaultFlushEntityEventListener:121 - Updating entity: [com.mitchell.services.technical.partialloss.estimate.bo.EstimateXmlAnnotation#2034]
 17:12:13,603 DEBUG Versioning:26 - Incrementing: 15 to 16
 *****************************************
 
 I really appriciate your help.
 Thanks,
 Manoj 
					
  
						
					 |