From 46cb1ea07d63031b21f289071424210645651cda Mon Sep 17 00:00:00 2001 From: Gail Badner Date: Thu, 8 Dec 2016 12:22:45 -0800 Subject: [PATCH] HHH-11241 : Missing column when executing HQL and criteria query with secondary table (cherry picked from commit b4b77f85d70765f420ab17c9128f9472175d6619) --- .../SubclassesWithSamePropertyNameTest.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/hibernate-core/src/test/java/org/hibernate/test/join/SubclassesWithSamePropertyNameTest.java b/hibernate-core/src/test/java/org/hibernate/test/join/SubclassesWithSamePropertyNameTest.java index cfb2ecc256..c1cb2c867b 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/join/SubclassesWithSamePropertyNameTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/join/SubclassesWithSamePropertyNameTest.java @@ -27,6 +27,7 @@ import static org.junit.Assert.assertEquals; */ @TestForIssue( jiraKey = "HHH-11241" ) public class SubclassesWithSamePropertyNameTest extends BaseCoreFunctionalTestCase { + private Long blogEntryId; @Override public String[] getMappings() { @@ -43,6 +44,30 @@ public class SubclassesWithSamePropertyNameTest extends BaseCoreFunctionalTestCa s.persist( blogEntry ); s.getTransaction().commit(); s.close(); + + blogEntryId = blogEntry.getId(); + } + + @Override + protected void cleanupTest() { + Session s = openSession(); + s.getTransaction().begin(); + s.createQuery( "delete from BlogEntry" ).executeUpdate(); + s.getTransaction().commit(); + s.close(); + } + + @Test + @TestForIssue( jiraKey = "HHH-11241" ) + @FailureExpected( jiraKey = "HHH-11241" ) + public void testGetSuperclass() { + Session s = openSession(); + Transaction tx = s.beginTransaction(); + Reportable reportable = s.get( Reportable.class, blogEntryId ); + assertEquals( "John Doe", reportable.getReportedBy() ); + assertEquals( "detail", ( (BlogEntry) reportable ).getDetail() ); + tx.commit(); + s.close(); } @Test