Add tests for map access with order

This commit is contained in:
Timo Westkämper 2015-10-29 23:38:40 +02:00
parent c59fe92a29
commit d48f81c938
2 changed files with 23 additions and 0 deletions

View File

@ -1075,6 +1075,26 @@ public abstract class AbstractJPATest {
assertEquals(1, query().from(show).where(show.acts.get("a").eq("A")).fetchCount());
}
@Test
public void Map_Order_Get() {
/*
* select show
* from Show show
* left join show.parent.acts as show_parent_acts_0 with key(show_parent_acts_0) = ?1
* order by show_parent_acts_0 asc
*/
QShow show = QShow.show;
assertEquals(Arrays.asList(), query().from(show).orderBy(show.parent.acts.get("A").asc()).fetch());
}
@Test
public void Map_Order_Get2() {
QShow show = QShow.show;
QShow parent = new QShow("parent");
assertEquals(Arrays.asList(), query().from(show).innerJoin(show.parent, parent)
.orderBy(parent.acts.get("A").asc()).fetch());
}
@Test
public void Map_ContainsKey() {
QShow show = QShow.show;

View File

@ -31,6 +31,9 @@ public class Show {
@MapKeyColumn(name = "acts_key")
public Map<String, String> acts;
@ManyToOne
public Show parent;
public Show() { }
public Show(int id) {