Home > ofbiz > Importing Seed/Demo Data

Importing Seed/Demo Data

December 19, 2006 Leave a comment Go to comments

Starting OFBiz for the first time

The first time you start OFBiz, you need to pre-load data into the database. Some of this data includes admin accounts, type constants, and demonstration data etc. This data is loaded from various xml files throughout the component ‘data’ directories. If you want to use the database structure that exists you really ought to load the ‘seed’ at the very least and the demo data for testing and evaluation.

Running the simple install all from Ant:

ant run-install

The command above will install all the data available (seed, demo).
If you want to load only the seed data run the following Ant task (available since rev. 4784):

ant run-install-seed

The comments below come from SVN by Andy on 7th Feb 2005.

Command line options:

–readers=seed,demo,ext (defined in entityengine.xml and configured in ofbiz-container.xml)
–delegator=default (overrides the delegator configured in the container file)
–group=org.ofbiz (overrides the group name configured in the container file)
–file=./foo.xml (loads a single file; if –readers is not specified, only this file will load)
–dir=./data (loads all XML files from this directory; if –readers is not specified, only files from this dir will load)
–timeout=7200 (overrides the default TX timeout)
–createfks=true (tells the XML reader to create dummy fks when necessary in order to load the data)

there are three pre-defined reader types:

seed – As it suggests the core data for type constants and basic login accounts. It will allow you access into the backend where you can easily load more data.
demo – loads all the demo data for areas like webstore, catalogues, products, facilities, content, accounts and manufacturing.
ext – Not used in the SVN code base, my guess is that you could use it to declare you own “ext”ernal demo files.

Some examples of above in use:

Same as current default behavior; loads all readers configured for the datasource

java -jar ofbiz.jar -install

specific reader change: load only seed data

java -jar ofbiz.jar -install -readers=seed

new feature load a directory along with all readers

java -jar ofbiz.jar -install -readers=all -dir=./external-data

new feature load a file pointing to a specific delegator

java -jar ofbiz.jar -install -file=./test-data.xml -delegator=test

Options can have ‘–option’, ‘-option’, or just ‘option’. No space is allowed before or after the ‘=’ sign. The order of the options no longer matters.

What to load with which option is configured in each components “ofbiz-component.xml” file. Example: applications/ecommerce/ofbiz-component.xml

...
    <entity-resource type="data" reader-name="demo"
 loader="main" location="data/DemoRentalProduct.xml"/>

    <entity-resource type="data" reader-name="ext"
 loader="main" location="data/MyData.xml"/>

...

These comments are for versions prior to 7th Feb 2005. Not sure when they came into force so don’t complain if they don’t working on version 2.1, just upgrade instead 😉

Running the install from the java command line

java -jar ofbiz.jar -install 9900

The 9900 value here is a transaction timeout value. If the timeout parameter is left off, the system will default to 7200 seconds.

A more selective data loading mechanism

The system supports passing the name of the data loaders on the install command line. Now supports a list of names and tx timeout:

java -jar ofbiz.jar -install seed,demo,ext 7200
(installs seed,demo,ext data using user defined timeout of 7200 sec)

or

java -jar ofbiz.jar -install all 7200
(installs all data using user defined timeout of 7200 sec)

or

java -jar ofbiz.jar -install seed
(installs just seed data using default timeout of 7200 sec)

or

java -jar ofbiz.jar -install
(installs all data using default timeout of 7200 sec)
Advertisements
Categories: ofbiz
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: