prop.setCascade( cascade );
prop.setPropertyAccessorName( propertyAccessorName );
Generated ann = property != null ?
property.getAnnotation( Generated.class ) :
null;
GenerationTime generated = ann != null ?
ann.value() :
null;
if (generated != null) {
if ( ! GenerationTime.NEVER.equals( generated ) ) {
if ( property.isAnnotationPresent( javax.persistence.Version.class )
&& GenerationTime.INSERT.equals( generated ) ) {
throw new AnnotationException("@Generated(INSERT) on a @Version property not allowed, use ALWAYS: "
+ StringHelper.qualify( holder.getPath(), name ) );
}
if ( prop.isInsertable() ) {
throw new AnnotationException("Cannot have @Generated property and insertable columns: "
+ StringHelper.qualify( holder.getPath(), name ) );
}
if ( GenerationTime.ALWAYS.equals( generated ) && prop.isUpdateable() ) {
throw new AnnotationException("Cannot have @Generated(ALWAYS) property and updatable columns: "
+ StringHelper.qualify( holder.getPath(), name ) );
}
prop.setGeneration( PropertyGeneration.parse( generated.toString().toLowerCase() ) );
}
}
log.trace( "Cascading " + name + " with " + cascade );
return prop;
}