OPENJPA-547 add test strings for FETCH JOINs

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@647026 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Catalina Wei 2008-04-11 01:08:29 +00:00
parent 810e401dbe
commit 07cd1728a1
1 changed files with 30 additions and 0 deletions
openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/joins

View File

@ -147,4 +147,34 @@ public class TestEJBJoins extends AbstractTestCase {
endEm(em);
}
public void testInnerJoinFetch() {
EntityManager em = currentEntityManager();
String query = "SELECT s FROM Student " +
"s JOIN FETCH s.department";
List ls = (List) em.createQuery(query)
.getResultList();
assertNotNull(ls);
assertEquals(2, ls.size());
em.close();
}
public void testLeftJoinFetch() {
EntityManager em = currentEntityManager();
String query = "SELECT s FROM Student " +
"s LEFT JOIN FETCH s.department";
List ls = (List) em.createQuery(query)
.getResultList();
assertNotNull(ls);
assertEquals(4, ls.size());
em.close();
}
}