Joined: Mon Apr 21, 2008 2:00 am Posts: 1
|
I am trying to use hibernate with DB2 8.1 database . I am facing problem while executing condtional query statement
the code is pasteed below
String testsql = " from RlaLic where LIC_NUMB_1500 = " + licno ;
RlaLic licd = (RlaLic) session.createQuery(testsql).uniqueResult();
the statement is working with condition hardcoded in statement
from RlaLic where LIC_NUMB_1500 = '0310012349'
but
from RlaLic where LIC_NUMB_1500 = " + licno is not working .
Even i tried with
("from RlaLic where LIC_NUMB_1500 = ? ").setString(0,licno).uniqueResult();
but its not working . i am getting null object .
what may be the problem ? any idea.
|
|