This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Query Language Question (simple)

 
Michael Jammy
Greenhorn
Posts: 11
Spring Ubuntu
  • Mark post as helpful
  • send pies
  • 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.

 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic