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

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -