orm - Hibernate Criteria One to Many -
i have sentence:
list l=getsessionfactory().getcurrentsession().createquery( "from domain d d.location.idlocation=?"). setparameter(0, idlocation).list();
and need query using criteria, don't know how use criteria in relation 1 many.
thx
try this,
criteria criteria = getdatabasesession().createcriteria(domain.class); criteria.createalias("location","loc"); criteria.add(restrictions.eq("loc.idlocation", idlocation)); list<domain> l=(list<domain>)criteria.list();
Comments
Post a Comment