SourceTap CRM Database Configuration

PDF
PDF

SourceTap CRM Database Configuration

The Entity Engine from the OFBiz project is what SourceTap CRM uses to persist data to a database. You can find out more about why we chose the EE at the bottom of this page. See the configuration overview for a conceptual overview of what is being done here.

Configuring the Entity Engine for SourceTap CRM

The configuration of the Entity Engine is done through a simple XML file called entityengine.xml. This file is used to define parameters for persistence servers such as JDBC datasource parameters.

For SourceTap CRM, this file is located in the distribution at components/entiy/config/entityengine.xml.

As outlined in the overview, the settings which generally need to be configured are:

  • Transaction Factory - see below
  • field type - edit the field-type-name attribute of the <datasource> tag.
  • datasource location - edit the jndi-name attribute of the <jndi-jdbc> tag relevant to your database.

Transaction Factory

By default the Entity Engine tries to obtain a JTA transaction factory from the application server using JNDI. This table shows the different values for different application servers:

Orion, Resin, Tomcat and Weblogic(see also the Orion, Resin, Tomcat and Weblogic guides)


<transaction-factory class="org.ofbiz.core.entity.transaction.JNDIFactory">
  <user-transaction-jndi jndi-server-name="default"
    jndi-name="java:comp/UserTransaction"/>
  <transaction-manager-jndi jndi-server-name="default"
    jndi-name="java:comp/UserTransaction"/>
</transaction-factory>

JBoss (see also the JBoss 2.4.4 and JBoss 3.0.x guides)


<transaction-factory class="org.ofbiz.core.entity.transaction.JNDIFactory">
  <user-transaction-jndi jndi-server-name="default"
    jndi-name="UserTransaction"/>
  <transaction-manager-jndi jndi-server-name="default"
    jndi-name="java:/TransactionManager"/>
</transaction-factory>

Jetty (see also Jetty guide)


<transaction-factory class="org.ofbiz.core.entity.transaction.JotmFactory" />

Altering the Entity Model

The Entity Model describes the table and column layout that SourceTap CRM uses in a database. It can be completely altered without changing any of the internal workings of SourceTap CRM.

The model provided should work with almost any database (care has been taken to ensure the column and table names are SQL compliant).

The entity model is configured through an XML file called entitymodel.xml (located in the distribution at hot-deploy/sfa/entitydef/entitymodel.xml).

The format of the file should be fairly self explanatory - basically SourceTap CRM always refers to the entity-name and field-name attributes within the code. The type attribute of a <field> tag should always match the type attribute of a <field-type-def> tag in your fieldtype-*.xml files.

To change where entities and fields are persisted in your database, simply add (or edit) the attribute table-name (for entities) or col-name (for fields).

Why we chose the Entity Engine

We chose the EE over CMP or BMP entity beans because:

  • it is more portable between application servers
  • table schemas are automatically created and updated
  • using the field type definitions, we can add support for new databases very quickly
  • it is faster than most CMP implementations and has some nice caching features

This document deals with configuring the entity engine for SourceTap CRM (but should be applicable to most applications). For more details on the entity engine itself and it's inner workings, see:

OFBiz Entity Engine Guide

describes the theory behind the entity engine, its architecture and usage patterns

OFBiz Entity Engine configuration guide

describes all of the entity engine configuration options, whereas this document just describes configuring the entity engine for SourceTap CRM

API Docs

the API docs for the org.ofbiz.entity package