public static VersionProperty buildVersionProperty(Property property,
boolean lazyAvailable) {
String mappedUnsavedValue = ( (KeyValue) property.getValue() ).getNullValue();
VersionValue unsavedValue = UnsavedValueFactory.getUnsavedVersionValue(
mappedUnsavedValue,
getGetter( property ),
(VersionType) property.getType(),
getConstructor( property.getPersistentClass() )
);
boolean lazy = lazyAvailable && property.isLazy();
return new VersionProperty(
property.getName(),
property.getNodeName(),
property.getValue().getType(),
lazy,
property.isInsertable(),
property.isUpdateable(),
property.getGeneration() == PropertyGeneration.INSERT || property.getGeneration() == PropertyGeneration.ALWAYS,
property.getGeneration() == PropertyGeneration.ALWAYS,
property.isOptional(),
property.isUpdateable() && !lazy,
property.isOptimisticLocked(),
property.getCascadeStyle(),
unsavedValue
);
}
Generates a VersionProperty representation for an entity mapping given its
version mapping Property. |