This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Hibernate criterion query with foreign key relation-ship 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 criterion query with foreign key relation-ship" Watch "Hibernate criterion query with foreign key relation-ship" New topic
Author

Hibernate criterion query with foreign key relation-ship

Narsimha Reddy
Greenhorn

Joined: Jan 08, 2008
Posts: 6
I have search functionality in my application. Search fields are not belongs to main table.Ids are avaible in main table , corresponding values are avalidable in related table.
I tried using Criterion

crit1=Restrictions.like("sector", sectorName);
detachedCriteria.add(crit1);....


Could some help me out ?
Jason Ferguson
Ranch Hand

Joined: Aug 09, 2007
Posts: 58
Could you give a bit more information?

First, can you share the object mappings between the two entities/tables?

Second, which type is sectorName? I'm assuming String, but need to know if sectorName is case-sensitive. If not, try using Restrictions.ilike() instead of Restrictions.like().

Jason

Originally posted by Narsimha Reddy:
I have search functionality in my application. Search fields are not belongs to main table.Ids are avaible in main table , corresponding values are avalidable in related table.
I tried using Criterion

crit1=Restrictions.like("sector", sectorName);
detachedCriteria.add(crit1);....


Could some help me out ?
Narsimha Reddy
Greenhorn

Joined: Jan 08, 2008
Posts: 6
I got solution for my problem.
I used alias for child table
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Hibernate criterion query with foreign key relation-ship
 
It's not a secret anymore!