Web / Apache OFBiz Interview questions
What is entitymodel.xml used for?
entitymodel.xml is the file (one per component, under entitydef/) that declares that component's data model for the Entity Engine: which entities exist, their fields and types, primary keys, indexes, and relations to other entities.
A typical entity declaration looks like this:
<entity entity-name="ExampleItem" package-name="org.apache.ofbiz.example"> <field name="exampleItemId" type="id-ne"/> <field name="itemName" type="name"/> <prim-key field="exampleItemId"/> </entity>
At startup the framework merges every component's entitymodel.xml into one logical model, then the Entity Engine uses that model to generate the actual database tables and validate every query at runtime, so a typo in a field name fails fast instead of producing a silent SQL error.
More Related questions...