Monday, 15 April 2013

java - HQL wildcards with elements/indices -


I have a hibernate map unit that has a hushmap.

If I want to find an example where there is a name like a key / value in the map: John I

'names' and elements in the index I can write 'John' in (attributes)

How can I get permission to use the wildcard to modify this HQL? I would like to find any such instances where the name starts with 'j' for example

You can change the parameters in your query using wildcards, for example if you are using Hibernate then your query should be something similar:

  getSession (). CreateQuery ('index' in index and 'John' in elements: (value)) .setString ("index", "'%" + index + "%'") .setString ("value", '' '%' "+ Value +"% '");  

No comments:

Post a Comment