}
}
final EntityKey key = EntityKeyBuilder.fromPersister( this, id, session );
final Tuple resultset = gridDialect.getTuple( key, this.getTupleContext() );
final SessionFactoryImplementor factory = getFactory();
if ( isImpliedOptimisticLocking && loadedState != null ) {
// we need to utilize dynamic delete statements
for ( int j = span - 1; j >= 0; j-- ) {
boolean[] versionability = getPropertyVersionability();
//TODO do a diff on the properties value from resultset
GridType[] types = gridPropertyTypes;
for ( int i = 0; i < entityMetamodel.getPropertySpan(); i++ ) {
boolean include = isPropertyOfTable( i, j ) && versionability[i];
if ( include ) {
final GridType type = types[i];
final Object snapshotValue = type.nullSafeGet(
resultset, getPropertyColumnNames( i ), session, object
);
//TODO support other entity modes
if ( ! type.isEqual( loadedState[i], snapshotValue, factory ) ) {
if ( factory.getStatistics().isStatisticsEnabled() ) {
factory.getStatisticsImplementor()
.optimisticFailure( getEntityName() );
}
throw new StaleObjectStateException( getEntityName(), id );
}
}