This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with Hibernate

 
Kanika Sud
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15286
39
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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%'.
 
Kanika Sud
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. It is. I posted that 'cause the ISO codes for locales don't need a 'like' generally. Besides, it served my purpose.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic