users@glassfish.java.net

how to cancel the whwere clause effect

From: <glassfish_at_javadesktop.org>
Date: Mon, 04 Jun 2007 21:01:35 PDT

hi all
in JPAQL
i wanna cancel the where clause effect in order to use the following example query
select u from user u where u.name= :name
the question is what to put for the value of the parameter:name to make the query get all the objects ,ie. make it match against any name,i know that this can be achieved with omiting the where clause alltogether but my real world query is much complex and i cannot guarentee that each time i run the query all the parameters will be assigned so i want to neutralize the effect of effect of the unassigned parameters by making a default that get all objects, i cannot use dynamically generated sql or jpaql as my db perform much much better with precompiled queries
please help me and tell me if ur solution is portable among JPA providers(in the spec )or just available in toplink
thanx alot
[Message sent by forum member 'fawzyj' (fawzyj)]

http://forums.java.net/jive/thread.jspa?messageID=220477