Hi Every one,
I have a simple named query like this from ProductGroup pb where pb.firstProductCode IN (?)in my mapping file.
<query name="getSecondProducts"><![CDATA[
from ProductGroup pb where pb.firstProductCode IN (?)]]>
</query>
I get the named query like this.
final Query query = session.getNamedQuery("getSecondProducts")
.setString(0, sb.toString());
Where sb is a
string buffer that i convert to a string to added to the query. The problem looks like Sb.toString seems not added to the query and does not return any values nor does i get an exception. But when i directly pass an SQL String Query Like this
final Query query=session.createSQLQuery("select * from pb2productgroup where firstlienproductcode in ('STRING1','STRING2') ");
The query works and i get some result.
Can any one please let me know if this is the right way to use Named Queries with "IN".