This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am having multiple texbox for different parameters of a POJO and through this values I have to execute query. If all parameters are explicitly submitted by user then there is no problem in query, since all criteria are there.
If user din't fill up all textbox what will be the query for checking null values and then only allowing it to be a part of criteria. I am using hibernate as ORM Tool.
1. check how many parameter are exist.
2. According to parameter create different criterion object and add in DetachedCriteria.
You can use DetachedCriteria.
Joined: Feb 15, 2012
It solved my problem that how i will be creating my hibernate query(parameter which i will be passing). But now i am facing a new problem that i am having two class A & B, with relation one to many so A is having Set<A>, now i want to query db with the help of Set<A> like where Set<A>=?, So what will be query in hql.