OPENJPA-967 add query test strings for JPA2 path nagivation thru KEY appear in FROM, WHERE, and ORDER BY clause

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@756151 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Catalina Wei 2009-03-19 19:36:46 +00:00
parent 6f253f050b
commit ed0f74a34b
1 changed files with 15 additions and 3 deletions

View File

@ -71,11 +71,23 @@ public class TestMany2ManyMapEx4 extends SingleEMFTestCase {
public void testQueryQualifiedId() throws Exception {
EntityManager em = emf.createEntityManager();
// a collection valued path thru KEY in FROM clause
String query1 = "select o.address.city from PhoneNumber p, " +
" in (p.emps) e, in(KEY(e).offices) o";
List rs1 = em.createQuery(query1).getResultList();
" in (p.emps) e, in(KEY(e).offices) o";
List rs1 = em.createQuery(query1).getResultList();
String query = "select KEY(e) from PhoneNumber p, " +
// a path thru KEY nagivation apprear in ORDER BY
query1 = "select o.address.city as city from PhoneNumber p, " +
" in (p.emps) e, in(KEY(e).offices) o order by city";
rs1 = em.createQuery(query1).getResultList();
// a path thru KEY nagivation apprear in WHERE clause
query1 = "select o.address.city as city from PhoneNumber p, " +
" in (p.emps) e, in(KEY(e).offices) o " +
" where o.address.city like '%1'";
rs1 = em.createQuery(query1).getResultList();
String query = "select KEY(e) from PhoneNumber p, " +
" in (p.emps) e order by e.empId";
List rs = em.createQuery(query).getResultList();
Division d = (Division) rs.get(0);