postgresql - Spring JPA @Query where clause with 'like' and 'or' -


i have following query:

@query("select c category c ( (lower(c.name) '%' || lower(:searchtext) || '%') or (lower(c.description) '%' || lower(:searchtext)) || '%')") 

my product designed run in multiple platform, getting error on postgresql is:

psqlexception: error: argument of or must type boolean, not type text.

which undestandable since clause return strings. wasn't able perform search in 1 query request. question how can perform search where conditions refer 2 differnt columns , use 'like' operator.

the parentheses have not correct following should work:

@query("select c category c " +        "where (lower(c.name) ('%' || lower(:searchtext) || '%')) " +          " or (lower(c.description) ('%' || lower(:searchtext) || '%'))") 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -