OPENJPA-2065: Add unit test for passing an interface as a result type.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1197988 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Richard G. Curtis 2011-11-05 16:52:27 +00:00
parent c66d5e1688
commit 8a72661ea0
2 changed files with 11 additions and 1 deletions

View File

@ -28,8 +28,11 @@ package org.apache.openjpa.persistence.query;
import java.util.Collection;
import javax.persistence.TypedQuery;
import org.apache.openjpa.persistence.query.common.apps.EntityInterface;
import org.apache.openjpa.persistence.query.common.apps.QueryTest1;
import org.apache.openjpa.meta.QueryMetaData;
@ -110,4 +113,11 @@ public class TestNamedQueries extends BaseQueryTest {
query.closeAll();
endEm(pm);
}
public void testInterfaceResultClass() {
OpenJPAEntityManager pm = getEM();
TypedQuery<EntityInterface> query = pm.createNamedQuery("named", EntityInterface.class);
assertEquals(10, query.getResultList().size());
}
}

View File

@ -45,7 +45,7 @@ import javax.persistence.NamedQuery;
@NamedQuery(name = "systemjdoql",
query = "select o FROM QueryTest1 where o.numb == 4")
})
public class QueryTest1 {
public class QueryTest1 implements EntityInterface {
/*
* Changed Variable names : Afam Okeke