Related Documents
Introduction
This document describes the configuration of the Entity Engine. It starts with an introduction to general ideas and then goes through each part of the entityengine.xml file and explains the available elements and their usage. The entityengine.xml file used for the OFBiz applications has examples of a number of different options and is located in ofbiz/commonapp/etc/entityengine.xml
.
The configuration of the Entity Engine is done through a simple XML file called entityengine.xml
that must exist somewhere on the classpath. This file is used to define parameters for persistence servers such as EJB server parameters or JDBC server parameters. It is also used to specify which XML entity model, entity group, and field type model files will be used for that server. The default file for the OFBiz distribution can be found in ofbiz/commonapp/etc/entityengine.xml
.
Each application that uses the Entity Engine does so through a Delegator
instance. The delegator name must be passed to the static factory method that is then passed to the constructor if a new instance is needed. This delegator name is used to look up settings for that delegator in the entityengine.xml
file. Each delegator uses an entity model reader and an entity group reader that specifies a group name for each named entity in the entity model file. The entityengine.xml
file contains the settings that map each group name to a GenericHelper
for that group. GenericHelper
is an interface that must be implemented for each type of data source (i.e.: JDBC, EJB, SOAP, HTTP, et cetera).
The settings for each named GenericHelper
are specified datsource
elements in the entityengine.xml
file. For a JDBC helper these would include database connection parameters such as either the JNDI data source parameters or the JDBC parameters including the driver name, the JDBC URI, and the username and password for the database. An EJB helper would contain JNDI parameters such as the context provider URL, the initial context factory, and the URL package prefixes.
The Delegator
is the primary access method for Entity Engine services. Each service request is dispatched to the helper that corresponds to the entity that the service is requested for according to the group name of the entity specified in the entity group XML file and the helper for that group specified in the entityengine.xml
file. The default entity group XML file for the OFBiz entity model can be found in ofbiz/commonapp/entitydef/entitygroup.xml
.