java - HibernateQueryException: unexpected token inside a number -



java - HibernateQueryException: unexpected token inside a number -

i hibernatequeryexception query. innerquery returns legit number (0194) outerquery throws exeption. cannot see error in syntax. unusual parseing exception starts within middle of number.

string innerquery = "select barcode info barcode not null"; list<string> innerresults = gethibernatetemplate().find(innerquery); //returns list 1 item "0194"; if(!innerresults.isempty()){ string outerquery = "from info d d.barcode in (" + innerresults.tostring().replace("[", "").replace("]", "") + ")"; homecoming gethibernatetemplate().find(outerquery); }

exception

org.springframework.orm.hibernate3.hibernatequeryexception: unexpected token: 94 near line 1, column 35 [from info d d.barcode in (0194)];

you have stored barcode field string (0194), must quote values.

so can apply fix:

string innerquery = "select concat(''', barcode, ''') info barcode not null";

java hibernate hql

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

ubuntu - Bash Script to Check That Files Are Being Created -