1 creating custom entity
For details about how to create a new object, refer to the example component. For more information, see the entitymodel. xml file of the example component. Follow these steps to create an object:
A. Create an entitydef subdirectory under hot-deploy/practice.
B. Create an entitymodel. xml file. This file includes the object definition you want to define.
C. to load the definition, You need to define an entry in the ofbiz-component.xml file, as shown below:
<entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/>
It can be seen that the server must be restarted to make those changes take effect.
See: http://docs.ofbiz.org/display/OFBTECH/General+Entity+Overview for details.
New entities are rarely defined in actual applications, because there is already an entity definition that has a great effect on business processing in OFBiz. Although you may feel that you want to add more fields to an existing object in some places, what can you do? The next step will show you how to expand an entity for your customization.
Previously, we usually needed one or more entitygroups in the same directory. XML file. This is no longer needed because the code has been checked into the trunk (because code is checked in to the trunk for this ).
2 extending an existing OOTB entity
Yes, you can expand existing entities to meet your custom needs. Follow these steps:
A. Expand your entity in the entitydef/entitymodel. xml file of your custom application as follows.
<extend-entity entity-name=""> <field name="" type=""/></extend-entity>
For example, you can refer to the entitymodel. xml file of the party component.
This is the simplest form. It can also become more complex. adding one or more fields to an existing object depends on the fields you want to customize. You can also define relationships with other entities here. However, before doing this, you have to perform a special search. The field you want to add may already exist for other purposes. We also need to expand and learn the data model before doing so.
For details about entity engine configuration, refer to entity engine Configuration Guide.
3 preparing data for Custom Application
To prepare data for your practice application, follow these steps:
A. Create a directory "data" in practice and a practicedata. xml file here.
B. We create data for a user. I must prepare the data for a member in the specified order, as shown below:
OFBiz advanced helloworld (5) create a new object