HHH-15060 - Associations with @NotFound should always be left joined when de-referenced in HQL/Criteria
- `@NotFound` no longer exports a physical foreign-key
This commit is contained in:
parent
5febc70134
commit
1f84125e44
|
@ -3462,10 +3462,20 @@ public final class AnnotationBinder {
|
|||
JoinColumns joinColumns,
|
||||
MetadataBuildingContext context) {
|
||||
final boolean noConstraintByDefault = context.getBuildingOptions().isNoConstraintByDefault();
|
||||
if ( ( joinColumn != null && ( joinColumn.foreignKey().value() == ConstraintMode.NO_CONSTRAINT
|
||||
|| joinColumn.foreignKey().value() == ConstraintMode.PROVIDER_DEFAULT && noConstraintByDefault ) )
|
||||
|| ( joinColumns != null && ( joinColumns.foreignKey().value() == ConstraintMode.NO_CONSTRAINT
|
||||
|| joinColumns.foreignKey().value() == ConstraintMode.PROVIDER_DEFAULT && noConstraintByDefault ) ) ) {
|
||||
|
||||
final NotFound notFoundAnn= property.getAnnotation( NotFound.class );
|
||||
if ( notFoundAnn != null ) {
|
||||
// supersedes all others
|
||||
value.setForeignKeyName( "none" );
|
||||
}
|
||||
else if ( joinColumn != null && (
|
||||
joinColumn.foreignKey().value() == ConstraintMode.NO_CONSTRAINT
|
||||
|| ( joinColumn.foreignKey().value() == ConstraintMode.PROVIDER_DEFAULT && noConstraintByDefault ) ) ) {
|
||||
value.setForeignKeyName( "none" );
|
||||
}
|
||||
else if ( joinColumns != null && (
|
||||
joinColumns.foreignKey().value() == ConstraintMode.NO_CONSTRAINT
|
||||
|| ( joinColumns.foreignKey().value() == ConstraintMode.PROVIDER_DEFAULT && noConstraintByDefault ) ) ) {
|
||||
value.setForeignKeyName( "none" );
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -91,7 +91,7 @@ public class NotFoundLogicalOneToOneTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT))
|
||||
// @JoinColumn(foreignKey = @ForeignKey(value = ConstraintMode.NO_CONSTRAINT))
|
||||
@NotFound(action = NotFoundAction.IGNORE)
|
||||
public Currency getCurrency() {
|
||||
return currency;
|
||||
|
|
Loading…
Reference in New Issue