Jeizi
Jeizi

Reputation: 57

HQL Query to select a list with any param from the displayed lists

I have a search form containing 4 dropdown lists and I want to create an HQL Query that search for the object list depending on the values selected in those dropdown lists I hope that I was clear ><

like :

private static final String QUERY_SEARCH_USERS  = "SELECT u FROM User where param = ... ";  

or I don't know how it should be ^^'

Is it possible ?

Upvotes: 0

Views: 371

Answers (1)

Dherik
Dherik

Reputation: 19100

The correct HQL/JPQL query:

SELECT u FROM User u 
WHERE u.id IS NULL OR u.id = :param1 AND u.name IS NULL OR u.name = :param2

Upvotes: 2

Related Questions