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

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -