Hi Folks,
I want to use criteria which matches the last eight digits of student id on UI with the last eight digits of student ids present in DB.For this i have subStringed id on UI and passing it in query to match it with DB.
I am using following criteria :
id_last8 = id.substring(-8); criteria.add(Restrictions.sqlRestriction(new StringBuilder().append("substr(id,-8)='").append(id_last8).append("'").toString()));
But this query is showing id_last8 in logs which it hit the DB as following :
where substr(id,-8)='23456789'
I don't want this id to be hardcoded in the query. I want it to be
where substr(id,-8)=?
Is there any way out to Do this...Kindly provide solution to this problem..Its urgent..TIA
|