mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Extend test for #322 - using inheritance discriminator with RawSql - extra test with columnMappingIgnore()
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user