# manage-entities > Manage OFBiz entity definitions (Data Model). Use when creating/modifying entities, debugging DB errors, or adding views. - Author: toaditi - Repository: toaditi/ofbiz-dev-agent-skills - Version: 20260124175846 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-06 - Source: https://github.com/toaditi/ofbiz-dev-agent-skills - Web: https://mule.run/skillshub/@@toaditi/ofbiz-dev-agent-skills~manage-entities:20260124175846 --- --- name: manage-entities description: Manage OFBiz entity definitions (Data Model). Use when creating/modifying entities, debugging DB errors, or adding views. --- # Skill: manage-entities (v1.0) ## Goal Manage OFBiz entity definitions (Data Model). ## Triggers **ALWAYS** read this skill when: - Creating or modifying entity definitions (`entitymodel.xml`). - Debugging database or SQL errors. - Adding View Entities. ## Use when - Creating new entities or views. - Extending core entities (only with permission). - Auditing data model. ## Don't use when - Modifying core framework entities directly (strict rule). - Creating duplicates of existing generic entities (e.g., Party, Facility). ## Inputs - required: Entity Name, Package - optional: Fields, Relations ## Outputs - Definition in `entitydef/entitymodel.xml` or `entitydef/entitymodel_view.xml`. ## Procedure 1. **Search**: `grep` for similar entities first. 2. Application entities in `entitydef/entitymodel.xml`. 3. **View Entities**: ALWAYS define in `entitydef/entitymodel_view.xml` for complex reads or joins. Avoid manual iteration/finding in code. 4. **Type**: - `entity`: Standard table (must have `prim-key`). - `view-entity`: Join. 5. **Build**: `./gradlew build` to validate. ## Guardrails - **Core Policy**: Do NOT modify/extend core entities without specific user approval. - **Types**: Use standard field types (`id`, `name`, `currency-amount`, `date-time`). - **Relations**: References must be exact (case-sensitive). - **System Design**: Perform data aggregation and calculations at the database level (using View Entities or SQL) whenever possible, rather than iterating in code. This improves performance and scalability. ## Failure handling - **Missing Entity**: Check `ofbiz-component.xml` loads the `entitymodel.xml`. - **DB Error**: SQL exceptions usually mean type mismatch or missing PK. ## Examples **Example A (New Entity)**: Input: 'Feature' entity. Output: ```xml ```