HHH-13217 : Correct warning and update test to fail if the query succeeds
This commit is contained in:
parent
5b11014c7c
commit
59749984cb
|
@ -1864,6 +1864,6 @@ public interface CoreMessageLogger extends BasicLogger {
|
||||||
void ignoreImmutablePropertyModification(String propertyName, String entityName);
|
void ignoreImmutablePropertyModification(String propertyName, String entityName);
|
||||||
|
|
||||||
@LogMessage(level = WARN)
|
@LogMessage(level = WARN)
|
||||||
@Message(value = "An entity cannot be annotated with both @Inheritance and @MappedSuperclass: %s.", id = 503)
|
@Message(value = "A class should not be annotated with both @Inheritance and @MappedSuperclass. @Inheritance will be ignored for: %s.", id = 503)
|
||||||
void unsupportedMappedSuperclassWithEntityInheritance(String entityName);
|
void unsupportedMappedSuperclassWithEntityInheritance(String entityName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -60,7 +61,7 @@ public class MappedSuperclassInheritanceTest extends BaseEntityManagerFunctional
|
||||||
super.buildEntityManagerFactory();
|
super.buildEntityManagerFactory();
|
||||||
|
|
||||||
assertTrue( triggerable.wasTriggered() );
|
assertTrue( triggerable.wasTriggered() );
|
||||||
assertTrue( triggerable.triggerMessage().contains( "An entity cannot be annotated with both @Inheritance and @MappedSuperclass" ) );
|
assertTrue( triggerable.triggerMessage().contains( "A class should not be annotated with both @Inheritance and @MappedSuperclass. @Inheritance will be ignored for" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -72,6 +73,7 @@ public class MappedSuperclassInheritanceTest extends BaseEntityManagerFunctional
|
||||||
try {
|
try {
|
||||||
//Check the @Inheritance annotation was ignored
|
//Check the @Inheritance annotation was ignored
|
||||||
entityManager.createQuery("from Employee").getResultList();
|
entityManager.createQuery("from Employee").getResultList();
|
||||||
|
fail();
|
||||||
} catch (Exception expected) {
|
} catch (Exception expected) {
|
||||||
QuerySyntaxException rootException = (QuerySyntaxException) ExceptionUtil.rootCause(expected);
|
QuerySyntaxException rootException = (QuerySyntaxException) ExceptionUtil.rootCause(expected);
|
||||||
assertEquals("Employee is not mapped", rootException.getMessage());
|
assertEquals("Employee is not mapped", rootException.getMessage());
|
||||||
|
|
Loading…
Reference in New Issue