Skip to content

Commit 5974998

Browse files
committed
HHH-13217 : Correct warning and update test to fail if the query succeeds
1 parent 5b11014 commit 5974998

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1864,6 +1864,6 @@ void attemptToAssociateProxyWithTwoOpenSessions(
18641864
void ignoreImmutablePropertyModification(String propertyName, String entityName);
18651865

18661866
@LogMessage(level = WARN)
1867-
@Message(value = "An entity cannot be annotated with both @Inheritance and @MappedSuperclass: %s.", id = 503)
1867+
@Message(value = "A class should not be annotated with both @Inheritance and @MappedSuperclass. @Inheritance will be ignored for: %s.", id = 503)
18681868
void unsupportedMappedSuperclassWithEntityInheritance(String entityName);
18691869
}

hibernate-core/src/test/java/org/hibernate/test/inheritance/MappedSuperclassInheritanceTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import static org.junit.Assert.assertEquals;
3232
import static org.junit.Assert.assertFalse;
3333
import static org.junit.Assert.assertTrue;
34+
import static org.junit.Assert.fail;
3435

3536
/**
3637
*
@@ -60,7 +61,7 @@ public void buildEntityManagerFactory() {
6061
super.buildEntityManagerFactory();
6162

6263
assertTrue( triggerable.wasTriggered() );
63-
assertTrue( triggerable.triggerMessage().contains( "An entity cannot be annotated with both @Inheritance and @MappedSuperclass" ) );
64+
assertTrue( triggerable.triggerMessage().contains( "A class should not be annotated with both @Inheritance and @MappedSuperclass. @Inheritance will be ignored for" ) );
6465
}
6566

6667
@Test
@@ -72,6 +73,7 @@ public void test() {
7273
try {
7374
//Check the @Inheritance annotation was ignored
7475
entityManager.createQuery("from Employee").getResultList();
76+
fail();
7577
} catch (Exception expected) {
7678
QuerySyntaxException rootException = (QuerySyntaxException) ExceptionUtil.rootCause(expected);
7779
assertEquals("Employee is not mapped", rootException.getMessage());

0 commit comments

Comments
 (0)