{"record":{"id":"7fdc52d2caeabeab","repo":"flowable/flowable-engine","slug":"deleting-a-single-process-definition-is-not-suppor","errorCode":null,"errorMessage":"Deleting a single process definition is not supported","messagePattern":"Deleting a single process definition is not supported","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ProcessDefinitionEntityManagerImpl.java","lineNumber":44,"sourceCode":"/**\n * @author Tom Baeyens\n * @author Falko Menge\n * @author Saeid Mirzaei\n * @author Joram Barrez\n */\npublic class ProcessDefinitionEntityManagerImpl\n    extends AbstractProcessEngineEntityManager<ProcessDefinitionEntity, ProcessDefinitionDataManager>\n    implements ProcessDefinitionEntityManager {\n\n    public ProcessDefinitionEntityManagerImpl(ProcessEngineConfigurationImpl processEngineConfiguration, ProcessDefinitionDataManager processDefinitionDataManager) {\n        super(processEngineConfiguration, processDefinitionDataManager);\n    }\n\n    @Override\n    public void delete(ProcessDefinitionEntity entity, boolean fireDeleteEvent) {\n        // There is no delete statement for deleting a single ProcessDefinition\n        // process definitions are deleted as part of a deployment\n        throw new FlowableException(\"Deleting a single process definition is not supported\");\n    }\n\n    @Override\n    public ProcessDefinitionEntity findLatestProcessDefinitionByKey(String processDefinitionKey) {\n        return dataManager.findLatestProcessDefinitionByKey(processDefinitionKey);\n    }\n\n    @Override\n    public ProcessDefinitionEntity findLatestProcessDefinitionByKeyAndTenantId(String processDefinitionKey, String tenantId) {\n        return dataManager.findLatestProcessDefinitionByKeyAndTenantId(processDefinitionKey, tenantId);\n    }\n    \n    @Override\n    public ProcessDefinitionEntity findLatestDerivedProcessDefinitionByKey(String processDefinitionKey) {\n        return dataManager.findLatestDerivedProcessDefinitionByKey(processDefinitionKey);\n    }\n\n    @Override","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/persistence/entity/ProcessDefinitionEntityManagerImpl.java#L26-L62","documentation":"Flowable does not support deleting a process definition entity individually. Process definitions are only removed as part of deleting their whole deployment (via RepositoryService.deleteDeployment), because the deployment owns the definition and its resources. Calling the entity manager's delete for a single ProcessDefinitionEntity deliberately throws this exception.","triggerScenarios":"Invoking ProcessDefinitionEntityManager.delete(entity, fireDeleteEvent) directly, e.g. from custom persistence/command code, or indirectly through an API that cascades deletes to a definition without deleting the deployment.","commonSituations":"Custom admin code trying to purge one deployed process version; writing a custom command that removes a definition while leaving its deployment; mistaken use of internal entity manager APIs instead of RepositoryService.","solutions":["Use RepositoryService.deleteDeployment(deploymentId) (optionally with cascade=true) to delete definitions together with their deployment.","If only certain versions should be hidden, migrate running instances and use setProcessDefinitionCategory or tenant isolation instead of deleting.","Avoid calling internal *EntityManagerImpl APIs; operate through RepositoryService commands."],"exampleFix":"// before\nprocessEngineConfiguration.getCommandExecutor().execute(... processDefinitionEntityManager.delete(def, false) ...);\n// after\nrepositoryService.deleteDeployment(deploymentId, true); // cascades definitions, resources, instances","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only delete definitions via RepositoryService.deleteDeployment","Avoid internal *EntityManagerImpl APIs in custom code","Hide obsolete versions via category/tenant strategy instead of deleting"],"tags":["repository","process-definition","unsupported"],"backgroundTag":"unsupported-operation","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}