aspose file tools
The moose likes EJB and other Java EE Technologies and the fly likes Hibernate Criteria when using many to one relation Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "Hibernate Criteria when using many to one relation" Watch "Hibernate Criteria when using many to one relation" New topic
Author

Hibernate Criteria when using many to one relation

kumar shiva
Greenhorn

Joined: Jul 04, 2012
Posts: 12
am new to Hibernate Criteria, please help me

am creating a Member pojo class, in this class this Member class is having two foreign ke ys businessunitid(Many to one relation), role_id(one to one relation) of classes BusinessUnit, Role respectively.(role,businessunit are references of Role,BusinessUnit respectively)



crit = hibsession.createCriteria(Member.class)
.createCriteria("role")
.add(Restrictions.eq("role_id",role_id));
this statement working fine but

Below statement giving Hibernate Exception:
crit = hibsession.createCriteria(Member.class)
.createCriteria("businessunit ")
.add(Restrictions.eq("businessunitid",businessunitid));
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Hibernate Criteria when using many to one relation
 
Similar Threads
Using Hibernate Criteria
Criteria.list() returns more objects than expected
querying two tables using criteria
Convert SQL to Criteria please
Hibernate doing a JOIN and a SELECT though only a JOIN is specified as FetchType and on the hbm