This is my mapping file.
Here the version column is getting saved when i do a .save() but when i call the .update() it is throwing that error. Do i need to set the version value again while updating?
<id name="customerPartyId" type="java.lang.Integer" column="CUSTOMER_PARTY_ID">
<generator class="sequence">
<param name="sequence">CUSTOMER_PARTY_ID_SEQ</param>
</generator>
</id>
<version name="versionSequenceNbr" column="VERSION_SEQUENCE_NBR"/>
<property name="effectiveDt" type="java.sql.Date" column="EFFECTIVE_DT" not-null="true" length="10"/>
This is my DAO method:::::::::::::::::
public PayerObligor updatePayerDetails(PayerDetailsTO argPayerDetailsTO) throws DAOException
, ConcurrentAccessException
{
try
{
System.out.println("Version Number = " +argPayerDetailsTO.getVersionNbr());
}
this.getHibernateTemplate().update(bisysFileDefaultRule);
this.getHibernateTemplate().save(payerHistory);
}
catch (HibernateOptimisticLockingFailureException e) {
System.out.println("Inside DAO HibernateOptimisticLockingFailureException");
HSABaseLogger.error(logger, "updatePayerDetails", "ERROR:-"
+ e.getMessage());
throw new ConcurrentAccessException(e);
} catch (DataAccessException e) {
HSABaseLogger.error(logger, "updatePayerDetails", "ERROR:-"
+ e.getMessage());
e.printStackTrace();
throw new DAOException(e);
} catch (HibernateException e) {
HSABaseLogger.error(logger, "updatePayerDetails", "ERROR:-"
+ e.getMessage());
throw new DAOException(e);
}
return argPayerObligor;
}
bisysFileDefaultRule is the table where that version sequence number is presnt.
|