This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate Criteria when using many to one relation  RSS feed

 
kumar shiva
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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));
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!