DATAJDBC-218 - The Column annotation affects the back reference too.
Also: Added documentation for the new behavior. Made the value of the column annotation optional by providing a default. Original pull request: #83.
This commit is contained in:
@@ -73,7 +73,13 @@ class BasicRelationalPersistentProperty extends AnnotationBasedPersistentPropert
|
||||
Assert.notNull(context, "context must not be null.");
|
||||
|
||||
this.context = context;
|
||||
this.columnName = Lazy.of(() -> Optional.ofNullable(findAnnotation(Column.class)).map(Column::value));
|
||||
|
||||
this.columnName = Lazy.of(() -> Optional.ofNullable( //
|
||||
findAnnotation(Column.class)) //
|
||||
.map(Column::value) //
|
||||
.filter(StringUtils::hasText) //
|
||||
);
|
||||
|
||||
this.keyColumnName = Lazy.of(() -> Optional.ofNullable( //
|
||||
findAnnotation(Column.class)) //
|
||||
.map(Column::keyColumn) //
|
||||
@@ -120,7 +126,7 @@ class BasicRelationalPersistentProperty extends AnnotationBasedPersistentPropert
|
||||
|
||||
@Override
|
||||
public String getReverseColumnName() {
|
||||
return context.getNamingStrategy().getReverseColumnName(this);
|
||||
return columnName.get().orElseGet(() -> context.getNamingStrategy().getReverseColumnName(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,7 +35,7 @@ public @interface Column {
|
||||
/**
|
||||
* The mapping column name.
|
||||
*/
|
||||
String value();
|
||||
String value() default "";
|
||||
|
||||
/**
|
||||
* The column name for key columns of List or Map collections.
|
||||
|
||||
Reference in New Issue
Block a user