What is the best way for querying by using the value of foreign object\'s field?
Suppose I have these three classes.
UnitResult class which describes amount
So how can I query all UnitResult where Unit type is UnitType.JUICES?
The way to do this in ORMLite is to use the `Where.in(...) with a sub-query:
// setup our sub-query on the Unit table first
QueryBuilder uQb = unitDao.queryBuilder();
uQb.where().eq(Unit.TYPE_FIELD_NAME, UnitType.JUICES);
// outer query on UnitResult table
QueryBuilder urQb = unitResultDao.queryBuilder();
// in using the sub-query
urQb.where().in(UnitResult.UNIT_COLUMN_NAME, uQb);
List results = urQb.query();