Confirmed:
EJBQLQuery query = new EJBQLQuery("delete from LegalEntity l where l.id =
:id");
query.setParameter("id", 1010L);
> Jun 27, 2012 10:13:01 AM org.apache.cayenne.log.CommonsJdbcEventLogger
> logConnect
> INFO: Opening connection:
> jdbc:h2:file:data/parkDB;create=true;MODE=PostgreSQL;DB_CLOSE_DELAY=-1
> Login: click
> Password: *******
> Jun 27, 2012 10:13:01 AM org.apache.cayenne.log.CommonsJdbcEventLogger
> logConnectSuccess
> INFO: +++ Connecting: SUCCESS.
> Jun 27, 2012 10:13:01 AM org.apache.cayenne.log.CommonsJdbcEventLogger log
> INFO: Detected and installed adapter: org.apache.cayenne.dba.h2.H2Adapter
> Jun 27, 2012 10:13:01 AM org.apache.cayenne.log.CommonsJdbcEventLogger
> logBeginTransaction
> INFO: --- transaction started.
> Jun 27, 2012 10:13:01 AM org.apache.cayenne.log.CommonsJdbcEventLogger
> logQuery
> INFO: DELETE FROM PERSON WHERE PERSON.ID = ? [bind: 1:1010]
> Jun 27, 2012 10:13:01 AM org.apache.cayenne.log.CommonsJdbcEventLogger
> logQueryError
>
NamedQuery query = new NamedQuery("LegalEntity.deleteById",
Collections.singletonMap("id", new Long[]{1010L}));
> Jun 27, 2012 10:12:25 AM org.apache.cayenne.log.CommonsJdbcEventLogger
> logConnect
> INFO: Opening connection:
> jdbc:h2:file:data/parkDB;create=true;MODE=PostgreSQL;DB_CLOSE_DELAY=-1
> Login: click
> Password: *******
> Jun 27, 2012 10:12:25 AM org.apache.cayenne.log.CommonsJdbcEventLogger
> logConnectSuccess
> INFO: +++ Connecting: SUCCESS.
> Jun 27, 2012 10:12:25 AM org.apache.cayenne.log.CommonsJdbcEventLogger log
> INFO: Detected and installed adapter: org.apache.cayenne.dba.h2.H2Adapter
> Jun 27, 2012 10:12:25 AM org.apache.cayenne.log.CommonsJdbcEventLogger
> logBeginTransaction
> INFO: --- transaction started.
> Jun 27, 2012 10:12:26 AM org.apache.cayenne.log.CommonsJdbcEventLogger
> logQuery
> INFO: DELETE FROM PERSON WHERE PERSON.ID = ? [bind: 1:NULL]
> Jun 27, 2012 10:12:26 AM org.apache.cayenne.log.CommonsJdbcEventLogger
> logUpdateCount
> INFO: === updated 0 rows.
> Jun 27, 2012 10:12:26 AM org.apache.cayenne.log.CommonsJdbcEventLogger
> logCommitTransaction
>
I can not see the Query.setParameter() pattern in the NamedQuery as well.
[1]
http://code.google.com/p/construtor/source/browse/trunk/park-samples/park-cayenne/src/test/java/park/model/LegalEntityTest.java
--
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-tp4024333p4024335.html
Sent from the Cayenne - User mailing list archive at Nabble.com.