[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: Help on Named Query
ebross
do-not-reply at jboss.com
Thu Mar 29 11:24:50 EDT 2007
Hi scout1lacno,
You have one additional 'and':
CategoryID and " + "and o.date LIKE :date ORDER BY o.datReceived DESC")
| instead of:
CategoryID" + "and o.date LIKE :date ORDER BY o.datReceived DESC")
|
This looks good :
Query queryTest = em.createNamedQuery("TblMessages.findMessages");
| queryTest.setParameter("CategoryID", CategoryID );
| queryTest.setParameter("date", date);
| List employees = queryTest.getResultList();
| return employees;
|
But you can also do:
Query queryTest = em.createNamedQuery("TblMessages.findMessages");
| queryTest.setParameter(1, CategoryID ); // the first parameter of the query
| queryTest.setParameter(2, date); // the second parameter of the query
| List employees = queryTest.getResultList();
| return employees;
|
I hops it helps.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032827#4032827
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032827
More information about the jboss-user
mailing list