• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic