• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Hibernate Query Language Question (simple)

 
Greenhorn
Posts: 11
Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,

I have a question, which should be easy to answer for any HQL pro. I execute the following code:

It queries the title column of the Product database, for my search query by the name of, "query". It works as it should. However, I want to use the same query to also check in p.productDesc.

I've tried many ways I can think of, including:

My other question is, how do I get it to also find part of the word. E.g. if my query is "hel", it also finds a row/column with "help me", or "where the hell did you go?". I tried "%", but it gives me errors everytime I add it.

 
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
q01) try this:

q02) "%hel" try something like this.
 
Michael Jammy
Greenhorn
Posts: 11
Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your response Hebert, however it did not work.

Here I querried for the word, "catisfactions" and the error was:


Also, adding % to my method as such:


causes the following error:
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At the way I putted to you, you will need to set up your parameter two times. [=
 
Michael Jammy
Greenhorn
Posts: 11
Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hebert Coelho wrote:At the way I putted to you, you will need to set up your parameter two times. [=



Thank you for your aid, I solved it as follows:

Also removed the lower() from ? because like ignores case.
 
Been there. Done that. Went back for more. But this time, I took this tiny ad with me:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic