wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Hibernate Query Language Question (simple) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate Query Language Question (simple)" Watch "Hibernate Query Language Question (simple)" New topic
Author

Hibernate Query Language Question (simple)

Michael Jammy
Greenhorn

Joined: Sep 21, 2011
Posts: 11

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.


Oracle Certified Java Programmer 6
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

q01) try this:

q02) "%hel" try something like this.


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Michael Jammy
Greenhorn

Joined: Sep 21, 2011
Posts: 11

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

Joined: Jul 14, 2010
Posts: 754

At the way I putted to you, you will need to set up your parameter two times. [=
Michael Jammy
Greenhorn

Joined: Sep 21, 2011
Posts: 11

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate Query Language Question (simple)