{"record":{"id":"026a9e554e48542a","repo":"Activiti/Activiti","slug":"only-provided-id-generation-allowed-for-properties","errorCode":null,"errorMessage":"only provided id generation allowed for properties","messagePattern":"only provided id generation allowed for properties","errorType":"exception","errorClass":"ActivitiException","httpStatus":null,"severity":"error","filePath":"activiti-core/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/PropertyEntityImpl.java","lineNumber":59,"sourceCode":"\n    public String getValue() {\n        return value;\n    }\n\n    public void setValue(String value) {\n        this.value = value;\n    }\n\n    public String getId() {\n        return name;\n    }\n\n    public Object getPersistentState() {\n        return value;\n    }\n\n    public void setId(String id) {\n        throw new ActivitiException(\"only provided id generation allowed for properties\");\n    }\n\n    // common methods //////////////////////////////////////////////////////////\n\n    @Override\n    public String toString() {\n        return \"PropertyEntity[name=\" + name + \", value=\" + value + \"]\";\n    }\n}\n","sourceCodeStart":41,"sourceCodeEnd":69,"githubUrl":"https://github.com/Activiti/Activiti/blob/56435b1a97deeafdc09dd40074b056c89fba5a8a/activiti-core/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/PropertyEntityImpl.java#L41-L69","documentation":"PropertyEntityImpl.setId is deliberately unassignable: property rows (ACT_GE_PROPERTY, e.g. next.dbid, schema.version) have their id (NAME_) assigned by the factory that creates them, so external setId calls are rejected with ActivitiException. The id generation for properties is 'provided' only, meaning it comes from PropertyEntity.create... constructors.","triggerScenarios":"Calling setId(\"name\") on a PropertyEntity obtained from PropertyEntityImpl or fetched from the engine, e.g. while trying to rename or re-key a property row.","commonSituations":"Custom engine extensions or migrations that patch properties via the entity API; framework mapping code (e.g. reflection-based hydration or ORM tooling) that generically calls setId on all entities.","solutions":["Do not change the id: create a new PropertyEntity via PropertyEntity.createByName(name) / createAndInsert and delete the old row instead.","Update the property's value with PropertyEntityManager.updateProperty(name, value), leaving the name/id untouched.","If generic entity code calls setId, exclude PropertyEntity from that path."],"exampleFix":"// before\nPropertyEntity prop = ...;\nprop.setId(\"next.dbid.v2\"); // throws\n\n// after\npropertyEntityManager.updateProperty(\"next.dbid\", newValue);","handlingStrategy":"try-catch","validationCode":"if (entity instanceof PropertyEntity) {\n    // ids are factory-provided; never call setId\n}","typeGuard":"null","tryCatchPattern":"try {\n    prop.setId(newName);\n} catch (ActivitiException e) {\n    // rename via new property entity instead\n}","preventionTips":["Treat PropertyEntity ids as immutable; change values only.","Exclude PropertyEntity from generic entity-hydration code that calls setId.","Use PropertyEntityManager.updateProperty(name, value) for mutations."],"tags":["activiti","property-entity","persistence","unsupported-operation","workflow"],"backgroundTag":"unsupported-operation","analyzedSha":"56435b1a97deeafdc09dd40074b056c89fba5a8a","analyzedAt":"2026-09-09T21:00:06.703Z","contentChangedAt":"2026-09-09T21:00:06.703Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}