[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - JPQL - Query Parameter
israel.bgf
do-not-reply at jboss.com
Thu May 14 09:14:11 EDT 2009
Supose the following situation:
class ObjectA
Integer id;
List list;
How can i make a JPQL that retrives a list of ObjectA that have at least N ObjectB. N is variable number. Example:
table ObjectA
[id]
1
2
------------------
table ObjectB
[id] [fk_objectA]
1 1
2 1
3 2
My search method would be...
List search(List param){
return em.createQuery("from ObjectA o where o have at least these :param").setParameter("param",param).getResultlist()
}
If param is a list with ObjectB(id=1) it would retrieve: ObjectA(id=1), the same would be true if param was a list with [ObjectB(id=1),ObjectB(id=2)]
Off course that this query don't work, but i want to do something like that. Is it possible? Or do i have to make a lot of string concatenation?
Thanks!
Israel
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4231077#4231077
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4231077
More information about the jboss-user
mailing list