• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate criterion query with foreign key relation-ship

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?
 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got solution for my problem.
I used alias for child table
reply
    Bookmark Topic Watch Topic
  • New Topic