Issue
i am trying to set the parameter lTList in the sqlquery with something like this => ['a',b','c'] but when i SOP after setting the parameter there is no change => "select .... lt in (:ltList) " what am i doing wrong
//List lTList=new ArrayList<String>();
Query selectQr = session.createSQLQuery("select id ipfs from ipfs where lt in(:lTList) and user_id='" + userId + "'");
selectQr.setParameterList("lTList", lTList);
There is no error but: query constructed : select .... lt in (:ltList)
query wanted : select .... lt in ('a','b','c')
Solution
The second comment was correct,
=>Why should the query change? THe parameters are applied upon execution. Also you should never use concat to create a query like this. Use another parameter to set the userid. - M. Deinum
The problem was that the setparameterlist was setting the parameters with quotes '', and i was already sending a list with quotes appended, thus on execution it became something like this- (''a'',''b'',''c'')
Answered By - Somya Jain
Answer Checked By - David Goodson (JavaFixing Volunteer)