use of org.apache.cayenne.query.EJBQLQuery in project cayenne by apache.
the class QuotedIdentifiersIT method testQuotedEJBQLQueryWithJoin.
@Test
public void testQuotedEJBQLQueryWithJoin() throws Exception {
String ejbql = "select p from Quote_Person p join p.address_Rel a where p.name = 'Arcadi'";
EJBQLQuery queryEJBQL = new EJBQLQuery(ejbql);
List resultList = context.performQuery(queryEJBQL);
assertEquals(1, resultList.size());
}
use of org.apache.cayenne.query.EJBQLQuery in project cayenne by apache.
the class QuotedIdentifiersIT method testQuotedEJBQLCountQuery.
@Test
public void testQuotedEJBQLCountQuery() throws Exception {
EJBQLQuery query = new EJBQLQuery("select count(p) from Quote_Person p");
assertEquals(Collections.singletonList(2L), context.performQuery(query));
query = new EJBQLQuery("select count(p.fULL_name) from Quote_Person p");
assertEquals(Collections.singletonList(0L), context.performQuery(query));
}
use of org.apache.cayenne.query.EJBQLQuery in project cayenne by apache.
the class QuotedIdentifiersIT method testQuotedEJBQLQuery.
@Test
public void testQuotedEJBQLQuery() throws Exception {
String ejbql = "select a from QuoteAdress a where a.group = '324'";
EJBQLQuery queryEJBQL = new EJBQLQuery(ejbql);
List objects11 = context.performQuery(queryEJBQL);
assertEquals(1, objects11.size());
}
use of org.apache.cayenne.query.EJBQLQuery in project cayenne by apache.
the class QuotedIdentifiersIT method testQuotedEJBQLQueryWithOrderBy.
@Test
public void testQuotedEJBQLQueryWithOrderBy() throws Exception {
EJBQLQuery query = new EJBQLQuery("select p from Quote_Person p order by p.name");
List<Quote_Person> resultList = (List<Quote_Person>) context.performQuery(query);
assertEquals(2, resultList.size());
assertEquals("Arcadi", resultList.get(0).getName());
assertEquals("Name", resultList.get(1).getName());
}
use of org.apache.cayenne.query.EJBQLQuery in project cayenne by apache.
the class DataDomainCallbacksIT method testPostLoad_MixedResult.
@Test
public void testPostLoad_MixedResult() throws Exception {
LifecycleCallbackRegistry registry = resolver.getCallbackRegistry();
registry.addCallback(LifecycleEvent.POST_LOAD, Artist.class, "postLoadCallback");
MockCallingBackListener listener = new MockCallingBackListener();
registry.addListener(LifecycleEvent.POST_LOAD, Artist.class, listener, "publicCallback");
Artist a1 = context.newObject(Artist.class);
a1.setArtistName("XX");
context.commitChanges();
assertEquals(0, a1.getPostLoaded());
assertNull(listener.getPublicCalledbackEntity());
EJBQLQuery q = new EJBQLQuery("select a, a.artistName from Artist a");
context.performQuery(q);
assertEquals(1, a1.getPostLoaded());
assertSame(a1, listener.getPublicCalledbackEntity());
}
Aggregations