HHH-6911 - Write DiscriminatorValue to DiscriminatorColumn when combined
with InheritanceType#JOINED Conflicts: hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java
This commit is contained in:
parent
d847a171eb
commit
e99f889bfd
|
@ -832,8 +832,32 @@ public final class AnnotationBinder {
|
|||
// we want to process the discriminator column if either:
|
||||
// 1) There is an explicit DiscriminatorColumn annotation && we are not told to ignore them
|
||||
// 2) There is not an explicit DiscriminatorColumn annotation && we are told to create them implicitly
|
||||
if ( ( discriminatorColumnAnnotation != null && !mappings.ignoreExplicitDiscriminatorColumnForJoinedInheritance() )
|
||||
|| ( discriminatorColumnAnnotation == null && mappings.useImplicitDiscriminatorColumnForJoinedInheritance() ) ) {
|
||||
final boolean generateDiscriminatorColumn;
|
||||
if ( discriminatorColumnAnnotation != null ) {
|
||||
if ( mappings.ignoreExplicitDiscriminatorColumnForJoinedInheritance() ) {
|
||||
LOG.debugf( "Ignoring explicit DiscriminatorColumn annotation on ", clazzToProcess.getName() );
|
||||
generateDiscriminatorColumn = false;
|
||||
}
|
||||
else {
|
||||
LOG.applyingExplicitDiscriminatorColumnForJoined(
|
||||
clazzToProcess.getName(),
|
||||
AvailableSettings.IGNORE_EXPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASS
|
||||
);
|
||||
generateDiscriminatorColumn = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( mappings.useImplicitDiscriminatorColumnForJoinedInheritance() ) {
|
||||
LOG.debug( "Applying implicit DiscriminatorColumn using DiscriminatorColumn defaults" );
|
||||
generateDiscriminatorColumn = true;
|
||||
}
|
||||
else {
|
||||
LOG.debug( "Ignoring implicit (absent) DiscriminatorColumn" );
|
||||
generateDiscriminatorColumn = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( generateDiscriminatorColumn ) {
|
||||
final DiscriminatorType discriminatorType = discriminatorColumnAnnotation != null
|
||||
? discriminatorColumnAnnotation.discriminatorType()
|
||||
: DiscriminatorType.STRING;
|
||||
|
|
|
@ -1617,7 +1617,7 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
@Message( value = "'javax.persistence.validation.mode' named multiple values : %s", id = 448 )
|
||||
void multipleValidationModes(String modes);
|
||||
|
||||
// id=449 & 450 used in 4.3
|
||||
// id=449-450 used in 4.3
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(
|
||||
|
@ -1634,4 +1634,16 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
@LogMessage(level = WARN)
|
||||
@Message(value = "Exception while discovering OSGi service implementations : %s", id = 453)
|
||||
void unableToDiscoverOsgiService(String service, @Cause Exception e);
|
||||
|
||||
// id=454-456 used in 4.3
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(
|
||||
id = 457,
|
||||
value = "Joined inheritance hierarchy [%1$s] defined explicit @DiscriminatorColumn. Legacy Hibernate behavior " +
|
||||
"was to ignore the @DiscriminatorColumn. However, as part of issue HHH-6911 we now apply the " +
|
||||
"explicit @DiscriminatorColumn. If you would prefer the legacy behavior, enable the `%2$s` setting " +
|
||||
"(%2$s=true)"
|
||||
)
|
||||
void applyingExplicitDiscriminatorColumnForJoined(String className, String overrideSetting);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue