Extend test for #322 - using inheritance discriminator with RawSql - extra test with columnMappingIgnore()

This commit is contained in:
Robin Bygrave
2015-09-03 16:29:45 +12:00
parent 7e66e0db1f
commit 97cf8b30f6
@@ -81,6 +81,7 @@ public class ParentRawSqlTest extends BaseTestCase {
joinToInheritanceHierarchy_withAliasMapping();
joinToInheritanceHierarchy();
joinToInheritanceHierarchy_withIgnore();
useColumnMappingIgnore();
@@ -109,6 +110,25 @@ public class ParentRawSqlTest extends BaseTestCase {
assertTrue(parent instanceof ChildB);
}
private void joinToInheritanceHierarchy_withIgnore() {
RawSql rawSql = RawSqlBuilder
.unparsed("select u.id, u.name, p.type as ptype, p.id as pid from rawinherit_uncle u join rawinherit_parent p where p.id = u.parent_id")
.columnMapping("id", "id")
.columnMapping("name", "name")
.columnMappingIgnore("ptype")
.columnMapping("pid", "parent.id")
.create();
List<EUncle> uncles = Ebean.find(EUncle.class).setRawSql(rawSql)
.fetch("parent", new FetchConfig().query())
.findList();
assertNotNull(uncles.get(0));
Parent parent = uncles.get(0).getParent();
assertTrue(parent instanceof ChildB);
}
private void joinToInheritanceHierarchy_withAliasMapping() {
RawSql rawSql = RawSqlBuilder