hibernate - SQL query.setParameter() not getting single quoted string in Java -


i trying run 1 sql query using indexed query as, list.add("'%" + some_string + "%'"); , set in query(sample) :

query=select * table name ?1; 

i setting parameter :

 query.setparameter(1, list.get(0)); 

it doesn't work, instead if put value directly in query, :

select * table name '%"+some_string+"%' 

it works. using jpa hibernate , postgres database.

is there internal parsing of single quotes while setting parameter

query.setparameter();

drop '' quotes placeholder value being added list.

list.add("%" + some_string + "%"); 

now query.setparameter(1, list.get(0)); should work expected because string value being bound ? placeholder not require quoted.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -