ENH: Add mappingsLocation config to search xml mapping files.

ENH: Add mappingsLocation config to search xml mapping files.

ENH: Add mappingsLocation config to search xml mapping files.

ENH: Add mappingsLocation config to search xml mapping files.

ENH: Add mappingsLocation config to search xml mapping files.

ENH: Add mappingsLocation config to search xml mapping files.

remove unused import.

ENH: Add mappingsLocation config and search xml mapping files feature.
This commit is contained in:
yuanxuegui
2018-03-17 17:27:51 +08:00
parent 9895e48485
commit 9d336cb20b
7 changed files with 159 additions and 21 deletions
@@ -250,4 +250,19 @@ public class EbeanServer_eqlTest extends BaseTestCase {
assertThat(query.getGeneratedSql()).contains("from o_customer t0 left join contact t1 on t1.customer_id = t0.id ");
}
@Test
public void namedQuery_fromCustomXmlLocations() {
ResetBasicData.reset();
Query<Customer> query = server()
.createNamedQuery(Customer.class, "withContactsById2")
.setParameter("id", 1);
query.setUseCache(false);
query.findOne();
assertThat(query.getGeneratedSql()).contains("from o_customer t0 left join contact t1 on t1.customer_id = t0.id ");
}
}
@@ -51,6 +51,32 @@ public class TestRawSqlOrmQuery extends BaseTestCase {
assertThat(sql).contains("where o.status = ? order by c.name, c.id");
}
@IgnorePlatform(Platform.ORACLE)
@Test
public void testNamed_fromCustomXmlLocations() {
ResetBasicData.reset();
Query<Order> query = Ebean.createNamedQuery(Order.class, "myRawTest2");
query.setParameter("orderStatus", Order.Status.NEW);
query.setMaxRows(10);
List<Order> list = query.findList();
for (Order order : list) {
order.getCretime();
}
String sql = query.getGeneratedSql();
if (isSqlServer()) {
assertThat(sql).contains("select top 10 o.id,");
} else {
assertThat(sql).contains("select o.id,");
assertThat(sql).contains("limit 10");
}
assertThat(sql).contains("o.id, o.status, o.ship_date, c.id, c.name, a.id, a.line_1, a.line_2, a.city from o_order o");
assertThat(sql).contains("join o_customer c on o.kcustomer_id = c.id ");
assertThat(sql).contains("where o.status = ? order by c.name, c.id");
}
@Test
public void test() {