GeeCON Prague 2014*
The moose likes Object Relational Mapping and the fly likes Problem with Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Problem with Hibernate " Watch "Problem with Hibernate " New topic
Author

Problem with Hibernate

Kanika Sud
Greenhorn

Joined: May 09, 2011
Posts: 21
Hi all,

I am new to hibernate. I want to perform the following query through hibernate somehow:



I have the corresponding classes and the hibernate mapping configured... but I have no idea of how to proceed.

Any help would be appreciated.
Thanks,
Kanika
Kanika Sud
Greenhorn

Joined: May 09, 2011
Posts: 21
Thanks, I have found the solution.
For the benefit of others, I am posting the code:



Once you add the locale name to the restrictions, it will resolve the subquery problem
And then, just create an object and set appropriate fields and save it to hibernate session.

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14190
    
  20

But is that not going to do an 'equals' query, instead of a 'like' query? In other words, that criteria will lead to an LocaleName = 'en_US' clause being added to the query, which is not the same as LocaleName like '%en_US%'.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Kanika Sud
Greenhorn

Joined: May 09, 2011
Posts: 21
Yes. It is. I posted that 'cause the ISO codes for locales don't need a 'like' generally. Besides, it served my purpose.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem with Hibernate