cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gilbertoca <gilbert...@gmail.com>
Subject How to create a EJBLQuery with a named parameterized query stored in the mapping?
Date Tue, 26 Jun 2012 20:40:42 GMT
Hi,

How to create a EJBLQuery with a named parameterized query stored in the
mapping?

I've not found any example[1].


> 	<query name="LegalEntity.deleteById"
> factory="org.apache.cayenne.map.EjbqlBuilder">
> 		<ejbql></ejbql>
> 	</query>	
> 

Code:


>     @Test
>     public void NamedDeleteById() {
>         System.out.println("\nDeleting Legal Entity by ID.\n");
>         //JPA-->Query query =
> em.createNamedQuery("LegalEntity.deleteById");
>         //JPA-->query.setParameter("id", 1010L);
>         //JPA-->int del = 0;
>         //JPA-->del = query.executeUpdate();
>         
>         ObjectContext context = runtime.getContext();
>         EJBQLQuery query = new EJBQLQuery("LegalEntity.deleteById");
>         query.setParameter("id", 1010L);
>         QueryResponse result = context.performGenericQuery(query);
> 
>         int[] count = result.firstUpdateCount();
>         assertTrue(count.length > 0);
>     }
> 
Any chance to have something like this: 
EJBQLQuery query = new EJBQLQuery(new NamedQuery("LegalEntity.deleteById"));

Regards,

Gilberto
[1] http://massapi.com/class/org/apache/cayenne/query/NamedQuery.java.html

--
View this message in context: http://cayenne.195.n3.nabble.com/How-to-create-a-EJBLQuery-with-a-named-parameterized-query-stored-in-the-mapping-tp4024333.html
Sent from the Cayenne - User mailing list archive at Nabble.com.

Mime
View raw message