column.setInsertable( false );
column.setUpdatable( false );
}
}
final JoinColumn joinColumn = property.getAnnotation( JoinColumn.class );
//Make sure that JPA1 key-many-to-one columns are read only tooj
boolean hasSpecjManyToOne=false;
if ( mappings.isSpecjProprietarySyntaxEnabled() ) {
String columnName = "";
for ( XProperty prop : inferredData.getDeclaringClass()
.getDeclaredProperties( AccessType.FIELD.getType() ) ) {
if ( prop.isAnnotationPresent( Id.class ) && prop.isAnnotationPresent( Column.class ) ) {
columnName = prop.getAnnotation( Column.class ).name();
}
if ( property.isAnnotationPresent( ManyToOne.class ) && joinColumn != null
&& ! BinderHelper.isEmptyAnnotationValue( joinColumn.name() )
&& joinColumn.name().equals( columnName )
&& !property.isAnnotationPresent( MapsId.class ) ) {
hasSpecjManyToOne = true;
for ( Ejb3JoinColumn column : columns ) {
column.setInsertable( false );
column.setUpdatable( false );
}
}
}
}
value.setTypeName( inferredData.getClassOrElementName() );
final String propertyName = inferredData.getPropertyName();
value.setTypeUsingReflection( propertyHolder.getClassName(), propertyName );
String fkName = null;
if ( joinColumn != null && joinColumn.foreignKey() != null ) {
fkName = joinColumn.foreignKey().name();
}
if ( StringHelper.isEmpty( fkName ) ) {
ForeignKey fk = property.getAnnotation( ForeignKey.class );
fkName = fk != null ? fk.name() : "";
}