java - Hibernate query for multiple associations -
i have following structure in java.
public class article { private long id; private source source; } public class source { private long id; private type type; } public class type { private long id; private string sourcetype; }
how query articles type.id = somevalue using hibernate criteria. right can query until source class this
criteria query = currentsession().createcriteria(article.class) .createalias("source", "s") .add(restrictions.eq("s.id", long.parselong(typeid)));
try this
criteria query = currentsession().createcriteria(article.class) .createalias("source", "s") .createalias("s.type","t") .add(restrictions.eq("t.id", long.parselong(typeid)));
Comments
Post a Comment