I know this is a fairly old question, but I hit this result in my search and I though that, for the record, I could help once I found the answer myself.
You'll need to create a DetachedCriteria for your class:
Code:
final DetachedCriteria userWithZipCode = forClass(Costumer.class, "det_cost");
Ten add the restriction for the zip code
Code:
userWithZipCode.add(eq("det_cost.zip", "02145"));
And then the restriction from the "parent" query
Code:
userWithZipCode.add(forName("det_cost.costumerId").eqProperty("item.costumerId"));
And finally add a projection, which is necessary to constraint the result to one column (I don't know if, because it's so simple, and only involves one table, this projection could be omitted).
Code:
userWithZipCode.setProjection(property("det_cost.zip"));
This detached criteria can be used now to, for example, check all the items that have to be sent to the given zip code:
Code:
Criteria criteria=getSession().createCriteria(Item.class, "item");
criteria.add(exists(userWithZipCode));
Hope it helps,
Alejandro