{"record":{"id":"6d31d726914ec9bf","repo":"greenrobot/greenDAO","slug":"property","errorCode":null,"errorMessage":"Property '","messagePattern":"Property '","errorType":"exception","errorClass":"DaoException","httpStatus":null,"severity":"error","filePath":"DaoCore/src/main/java/org/greenrobot/greendao/query/WhereCollector.java","lineNumber":88,"sourceCode":"\n    void checkCondition(WhereCondition whereCondition) {\n        if (whereCondition instanceof WhereCondition.PropertyCondition) {\n            checkProperty(((WhereCondition.PropertyCondition) whereCondition).property);\n        }\n    }\n\n    void checkProperty(Property property) {\n        if (dao != null) {\n            Property[] properties = dao.getProperties();\n            boolean found = false;\n            for (Property property2 : properties) {\n                if (property == property2) {\n                    found = true;\n                    break;\n                }\n            }\n            if (!found) {\n                throw new DaoException(\"Property '\" + property.name + \"' is not part of \" + dao);\n            }\n        }\n    }\n\n    void appendWhereClause(StringBuilder builder, String tablePrefixOrNull, List<Object> values) {\n        ListIterator<WhereCondition> iter = whereConditions.listIterator();\n        while (iter.hasNext()) {\n            if (iter.hasPrevious()) {\n                builder.append(\" AND \");\n            }\n            WhereCondition condition = iter.next();\n            condition.appendTo(builder, tablePrefixOrNull);\n            condition.appendValuesTo(values);\n        }\n    }\n\n    boolean isEmpty() {\n        return whereConditions.isEmpty();","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/greenrobot/greenDAO/blob/0bbb338e17c4cf28aba5aae62d42f73f50186157/DaoCore/src/main/java/org/greenrobot/greendao/query/WhereCollector.java#L70-L106","documentation":"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.","triggerScenarios":"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\")).","commonSituations":"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.","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."],"exampleFix":"// before\nuserDao.queryBuilder().where(DeptDao.Properties.Name.eq(\"sales\"));\n// after\nuserDao.queryBuilder()\n  .join(DeptDao.class, UserDao.Properties.DeptId)\n  .where(DeptDao.Properties.Name.eq(\"sales\"));","handlingStrategy":"type-guard","validationCode":"// at call sites, import the matching Properties class explicitly\nimport org.greenrobot.greendao.sample.UserDao.Properties;","typeGuard":"boolean belongsToDao(Property p, AbstractDao<?, ?> dao) {\n  for (Property q : dao.getProperties()) if (q == p) return true;\n  return false;\n}","tryCatchPattern":"try { qb.where(prop.eq(v)); } catch (DaoException e) { throw new IllegalArgumentException(\"use the Properties class of \" + e.getMessage()); }","preventionTips":["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."],"tags":["greendao","querybuilder","android","database"],"backgroundTag":"invalid-argument-value","analyzedSha":"0bbb338e17c4cf28aba5aae62d42f73f50186157","analyzedAt":"2026-09-08T03:22:36.050Z","contentChangedAt":"2026-09-08T03:22:36.050Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}