mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-10-24 15:55:55 +00:00
No effective change - add tests for RawSql tableAlias mapping of root type to null path and not mapping it
This commit is contained in:
@@ -13,6 +13,7 @@ import org.junit.Test;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import static org.assertj.core.api.StrictAssertions.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
@@ -127,6 +128,50 @@ public class TestRawSqlMasterDetail extends BaseTestCase {
|
||||
assertFalse(ordersFromRaw.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTableAlias_with_rootTypeMappedNotMapped() {
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
String rs = "select o.id, o.status " +
|
||||
"from o_order o order by o.id asc";
|
||||
|
||||
RawSql rawSql = RawSqlBuilder.parse(rs)
|
||||
.create();
|
||||
|
||||
List<Order> ordersFromRaw = Ebean.find(Order.class)
|
||||
.setRawSql(rawSql)
|
||||
.findList();
|
||||
|
||||
for (Order order : ordersFromRaw) {
|
||||
assertThat(order.getId()).isNotNull();
|
||||
assertThat(order.getStatus()).isNotNull();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTableAlias_with_rootTypeMappedToNullPath() {
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
String rs = "select o.id, o.status " +
|
||||
"from o_order o order by o.id asc";
|
||||
|
||||
RawSql rawSql = RawSqlBuilder.parse(rs)
|
||||
.tableAliasMapping("o", null)
|
||||
.create();
|
||||
|
||||
List<Order> ordersFromRaw = Ebean.find(Order.class)
|
||||
.setRawSql(rawSql)
|
||||
.findList();
|
||||
|
||||
for (Order order : ordersFromRaw) {
|
||||
assertThat(order.getId()).isNotNull();
|
||||
assertThat(order.getStatus()).isNotNull();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithMultipleManys() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user