greenrobot/greenDAO · error · DaoException
Property '
Error message
Property '
What it means
WhereCollector.checkProperty() verifies that a Property used in a where() condition belongs to the DAO (table) the query is built for. If the property is from another entity's Properties class, a DaoException 'Property ... is not part of <dao>' is thrown. This catches cross-entity condition mistakes at query-build time.
Solutions
- Use the Properties class matching the DAO: userDao.queryBuilder().where(UserDao.Properties.X...).
- For conditions on a joined table, put them on the join builder: .join(DeptDao.class, ...).where(DeptDao.Properties.Name.eq(...)).
- Check imports — static imports of the wrong Properties class are the usual culprit.
Example fix
// before
userDao.queryBuilder().where(DeptDao.Properties.Name.eq("sales"));
// after
userDao.queryBuilder()
.join(DeptDao.class, UserDao.Properties.DeptId)
.where(DeptDao.Properties.Name.eq("sales")); Defensive patterns
Strategy: type-guard
Validate before calling
// at call sites, import the matching Properties class explicitly import org.greenrobot.greendao.sample.UserDao.Properties;
Type guard
boolean belongsToDao(Property p, AbstractDao<?, ?> dao) {
for (Property q : dao.getProperties()) if (q == p) return true;
return false;
} Try / catch
try { qb.where(prop.eq(v)); } catch (DaoException e) { throw new IllegalArgumentException("use the Properties class of " + e.getMessage()); } Prevention
- Use static-import-free explicit references like UserDao.Properties.X.
- Put joined-table conditions on the join() builder, not the base where().
- Review copy-pasted queries for the wrong Properties class.
When it happens
Trigger: Passing a Property from a different entity's Properties class into where() of another DAO's queryBuilder — e.g. userDao.queryBuilder().where(DeptDao.Properties.Name.eq("x")).
Common situations: Copy-pasting query code between entities, or mixing Properties classes when building joins without putting the foreign condition on the joined table's section of the builder.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- This operation only works with cached lazy lists
- No entity found for query
- Offset cannot be set without limit
- Expected unique result, but count was
- Cannot delete entity, key is null
AI-assisted analysis of greenrobot/greenDAO@0bbb338e17 (2026-09-08).
Data as JSON: /api/errors/6d31d726914ec9bf.
Report an issue: GitHub.
Appendix: source
Thrown at DaoCore/src/main/java/org/greenrobot/greendao/query/WhereCollector.java:88
void checkCondition(WhereCondition whereCondition) {
if (whereCondition instanceof WhereCondition.PropertyCondition) {
checkProperty(((WhereCondition.PropertyCondition) whereCondition).property);
}
}
void checkProperty(Property property) {
if (dao != null) {
Property[] properties = dao.getProperties();
boolean found = false;
for (Property property2 : properties) {
if (property == property2) {
found = true;
break;
}
}
if (!found) {
throw new DaoException("Property '" + property.name + "' is not part of " + dao);
}
}
}
void appendWhereClause(StringBuilder builder, String tablePrefixOrNull, List<Object> values) {
ListIterator<WhereCondition> iter = whereConditions.listIterator();
while (iter.hasNext()) {
if (iter.hasPrevious()) {
builder.append(" AND ");
}
WhereCondition condition = iter.next();
condition.appendTo(builder, tablePrefixOrNull);
condition.appendValuesTo(values);
}
}
boolean isEmpty() {
return whereConditions.isEmpty();View on GitHub (pinned to 0bbb338e17)