use of org.hibernate.tuple.ValueGeneration in project hibernate-orm by hibernate.
the class AbstractEntityPersister method isValueGenerationRequired.
private boolean isValueGenerationRequired(NonIdentifierAttribute attribute, GenerationTiming matchTiming) {
if (attribute.getType() instanceof ComponentType) {
final ComponentType type = (ComponentType) attribute.getType();
final ValueGeneration[] propertyValueGenerationStrategies = type.getPropertyValueGenerationStrategies();
for (int i = 0; i < propertyValueGenerationStrategies.length; i++) {
if (isReadRequired(propertyValueGenerationStrategies[i], matchTiming)) {
return true;
}
}
return false;
} else {
return isReadRequired(attribute.getValueGenerationStrategy(), matchTiming);
}
}
use of org.hibernate.tuple.ValueGeneration in project hibernate-orm by hibernate.
the class PropertyBinder method determineValueGenerationStrategy.
private ValueGeneration determineValueGenerationStrategy(XProperty property) {
ValueGeneration valueGeneration = getValueGenerationFromAnnotations(property);
if (valueGeneration == null) {
return NoValueGeneration.INSTANCE;
}
final GenerationTiming when = valueGeneration.getGenerationTiming();
if (valueGeneration.getValueGenerator() == null) {
insertable = false;
if (when == GenerationTiming.ALWAYS) {
updatable = false;
}
}
return valueGeneration;
}
Aggregations