• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate query using named parameter and %

 
Ricardo Estafan
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having some difficulties creating a hibernate query using both named parameters and the %.

For instance when i search for a certain product using a named query and named parameters it looks like this :

<query name="searchProducts">
<![CDATA[from Product where amount != 0 and namelike %:searchText% or title like %:searchText%]]>
</query>

I can't get it to work.

Can anybody help me out?

Thank you.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that you would need to use the wildcards in the bind data, not in the query itself.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic