HHH-11241 : Missing column when executing HQL and criteria query with secondary table

(cherry picked from commit b4b77f85d70765f420ab17c9128f9472175d6619)
This commit is contained in:
Gail Badner 2016-12-08 12:22:45 -08:00
parent 400afbb8c3
commit 46cb1ea07d
1 changed files with 25 additions and 0 deletions

View File

@ -27,6 +27,7 @@ import static org.junit.Assert.assertEquals;
*/ */
@TestForIssue( jiraKey = "HHH-11241" ) @TestForIssue( jiraKey = "HHH-11241" )
public class SubclassesWithSamePropertyNameTest extends BaseCoreFunctionalTestCase { public class SubclassesWithSamePropertyNameTest extends BaseCoreFunctionalTestCase {
private Long blogEntryId;
@Override @Override
public String[] getMappings() { public String[] getMappings() {
@ -43,6 +44,30 @@ public class SubclassesWithSamePropertyNameTest extends BaseCoreFunctionalTestCa
s.persist( blogEntry ); s.persist( blogEntry );
s.getTransaction().commit(); s.getTransaction().commit();
s.close(); 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 @Test