fields[versionProperty] = seed( versionType, session ); return true;
fields[versionProperty] = seed( versionType, session ); return true;
fields[versionProperty] = seed( versionType, session ); return true;
/** * Create an initial optimistic locking value according the {@link VersionSupport} * contract for the version property <b>if required</b> and inject it into * the snapshot state. * * @return True if we injected a new version value into the fields array; false * otherwise. */ public static boolean seedVersion( Object[] fields, VersionDescriptor versionDescriptor, SharedSessionContractImplementor session) { final int versionPosition = versionDescriptor.getStateArrayPosition(); final Object initialVersion = fields[ versionPosition ]; if ( initialVersion==null || // This next bit is to allow for both unsaved-value="negative" // and for "older" behavior where version number did not get // seeded if it was already set in the object // TODO: shift it into unsaved-value strategy ( (initialVersion instanceof Number) && ( (Number) initialVersion ).longValue()<0 ) ) { fields[versionPosition] = seed( versionDescriptor.getVersionSupport(), session ); return true; } LOG.tracev( "Using initial version: {0}", initialVersion ); return false; }