|
|
| hibernate code problem |
Expert:shakti rath
String SQL_QUERY =" from Insurance as insurance where insurance. lngInsuranceId='1'"; Query query = session.createQuery (SQL_QUERY); for(Iterator it=query.iterate() ;it.hasNext();){ Insurance insurance=(Insurance)it .next(); System.out.println("ID: " + insurance. getLngInsuranceId()); System.out.println("Name: " + insurance. getInsuranceName()); }
in the above code,the hibernate where clause was used and then it was iterate to fetch the values. but my question is in the where clause will search when the values is 1 like this lngInsuranceId='1'. but i want to search not only the value 1 but the value that is dynamically assigned like this lngInsuranceId="'+name+'"
plz help me out thanks shakti |
| Answers |
Hi friend,
Your code is :
String SQL_QUERY =" from Insurance as insurance where insurance. lngInsuranceId='1'"; Query query = session.createQuery (SQL_QUERY); for(Iterator it=query.iterate() ;it.hasNext();){ Insurance insurance=(Insurance)it .next(); System.out.println("ID: " + insurance. getLngInsuranceId()); System.out.println("Name: " + insurance. getInsuranceName());
}
Then "name" get Dynamically :
like name= request.getParameter("name");
For more information on hibernate visit to :
http://www.roseindia.net/hibernate/
Thanks
|
| More Questions |
|
|
Post Answers
Ask Question
Facing Programming Problem?
|
|
|
|
|