}
private AnnotationMetadataBuilder getJoinColumnAnnotation(
final Reference reference, final boolean referencedColumn,
final JavaType fieldType, final Boolean nullable) {
final Column localColumn = reference.getLocalColumn();
Validate.notNull(localColumn, "Foreign-key reference local column '"
+ reference.getLocalColumnName() + "' must not be null");
final AnnotationMetadataBuilder joinColumnBuilder = new AnnotationMetadataBuilder(
JOIN_COLUMN);
joinColumnBuilder
.addStringAttribute(NAME, localColumn.getEscapedName());
if (referencedColumn) {
final Column foreignColumn = reference.getForeignColumn();
Validate.notNull(
foreignColumn,
"Foreign-key reference foreign column '%s' must not be null",
reference.getForeignColumnName());
joinColumnBuilder.addStringAttribute("referencedColumnName",
foreignColumn.getEscapedName());
}
if (nullable == null) {
if (localColumn.isRequired()) {
joinColumnBuilder.addBooleanAttribute("nullable", false);