ec.getStatistics().incrementNumReads();
}
refreshedEntity = datastoreMgr.getDatastoreServiceForReads(op.getExecutionContext()).get(entity.getKey());
} catch (EntityNotFoundException e) {
// someone deleted out from under us
throw new NucleusOptimisticException(GAE_LOCALISER.msg("AppEngine.OptimisticError.EntityHasBeenDeleted", operation,
cmd.getFullClassName(), entity.getKey()));
}
Object datastoreVersion = refreshedEntity.getProperty(versionPropertyName);
if (vmd.getVersionStrategy() == VersionStrategy.DATE_TIME) {
datastoreVersion = new Timestamp((Long) datastoreVersion);
}
if (!datastoreVersion.equals(curVersion)) {
throw new NucleusOptimisticException(GAE_LOCALISER.msg("AppEngine.OptimisticError.EntityHasBeenUpdated", operation,
cmd.getFullClassName(), entity.getKey()));
}
}
Object nextVersion = VersionHelper.getNextVersion(vmd.getVersionStrategy(), curVersion);