aspose file tools*
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 13875
    
  10

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 7 API documentation
Scala Notes - My blog about Scala
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
 
Similar Threads
hibernate lucene integration sample projects
Why two xml files?
problem in mapping hibernate class
"Could not read mapping document from file:"
struts vs spring framework