Hi everyone:
There is a search function in my web application.I want to implement the function using hibernate. But the problem is that the query parameter is too much. There are 10 parameter in this site search function. So I think it has a problem. For example:
search according the following condition:
name: age: email: address: cell_phone:
home_phone: phone: country: ... ... etc...
If the client don't input any things my method will get a "null" value or a blank value. The function will not work property. But the fact is that if user don't input anything the condition will be all. I mean that if user don't input the name parameter,the function will query all name's data.
For example:
if the input info is this:
name: yashnoo. email:
[email protected]
the query will be :
Code:
from mytable where name=yashnoo and
[email protected]if the input info is this:
name: (not input anything) email:
[email protected]the query will be:
Code:
from mytable where
[email protected]Not this:
Code:
from mytable where name=null and
[email protected]
The later will query nothing obviously.
Could hibernate has any query method that can ignore null value? THks