james_nemesh wrote:
hagios17 wrote:
bkmr_77 wrote:
Did the patch that was listed off of your link fix the problem for you?
In reply to myself, yes, the patch works. This kind of query evaluates with Hibernate 3.2CR4:
DetachedCriteria query1 = DetachedCriteria.forClass(PhenoAttributeHistory.class, "pah")
.createAlias("phenoAttributes", "pa")
.createAlias("pa.phenoProjAttributeType", "ppat")
.createAlias("ppat.phenoAttributeType", "pat")
.add(Restrictions.and(Restrictions.eq("pat.name", "BMI"), Restrictions.gt ("pa.valueDouble", 20D)))
.setProjection(Property.forName("lsid"));
DetachedCriteria query2 = DetachedCriteria.forClass(PhenoAttributeHistory.class, "pah")
.createAlias("phenoAttributes", "pa")
.createAlias("pa.phenoProjAttributeType", "ppat")
.createAlias("ppat.phenoAttributeType", "pat")
.add(Restrictions.and(Restrictions.eq("pat.name", "Chol"), Restrictions.gt ("pa.valueDouble", 200D)))
.setProjection(Property.forName("lsid"));
DetachedCriteria query3 = DetachedCriteria.forClass(PhenoAttributeHistory.class, "pah")
.createAlias("phenoAttributes", "pa")
.createAlias("pa.phenoProjAttributeType", "ppat")
.createAlias("ppat.phenoAttributeType", "pat")
.add(Restrictions.and(Restrictions.eq("pat.name", "Weight"), Restrictions.gt ("pa.valueDouble", 160D)))
.setProjection(Property.forName("lsid"));
Criteria andQuery = hsession.createCriteria(PhenoAttributeHistory.class, "pah2")
.add(
Restrictions.and(
Restrictions.and(
(Subqueries.propertyIn("lsid", query1)),
(Subqueries.propertyIn("lsid", query2))),
Subqueries.propertyIn("lsid", query3)));
(sorry about the formatting)