Hi I am using hibernate for my project . I need to form a query , its for search user purpose. in my user table i have logind,firstname,lastname,roleid,email etc. The user may enter only few details and then search. In this situation i need to form the hibernate query with the only fields that the users entered values.how can we implement this?
for example if the user enters loginid and firstname
then
select from User user where user.logind=1 and firstname like ‘ABC’
please helpme out
Hibernate provides an Example API where you can use a partially filled object of what you’re looking for to execute a query. You can read more about it here:
http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/querycriteria.html#querycriteria-examples