Skip to main content

Getting started

Setting up your project

To get started, you have to add the SQL expanders as an expansion resource to your application project. This can be done either in the µRadiant, or directly in the expansion settings file.

µRadiant

  1. Open the model for your JEE application.
  2. Go the to settings tab.
  3. Add a new expansion resource with name net.democritus:sql-expanders and version 4.0.0.

Project files

  1. Open the expansion settings file for your application, which is often found in the conf folder in the root of your project's workspace with the name expansionSettings.xml.
  2. Add a child element to expansionResources as follows:
    <expansionResource name="net.democritus:sql-expanders" version="4.0.0"/>

Generating scripts

Generating SQL scripts with the SQL Expanders is as simple as adding the expansion resource. It will automatically generate a script to generate a file to provision an SQL schema structure with the correct database dialect based on the settings of your ApplicationInstance model.

Aside from purely generating the SQL scheme to store your data, it will also attempt to provision the needed infrastructure for your persistence framework depending on which you have selected in your ApplicationInstance model. At this time, infrastructure for several methods of id generation in both Hibernate and OpenJPA are supported.

Scripts to provision the database schema(s) will be generated as [APPLICATION_ROOT]/database/001-app-database.sql.

Option
sql.structureFile.name ApplicationApplicationInstance

This option can be used to defined the name of the initial database structure script that is generated by the expanders. The name should not include the extension, as this is added by the expanders themselves.

<options>
<sql.structureFile.name>000-init-database</sql.structureFile.name>
</options>
<options>
<sql.structureFile.name>V1__initial_table_structure</sql.structureFile.name>
</options>
Option
excludeFromSqlGeneration Component

Entire components can easily be excluded from SQL script generation by adding this option. All components that do not have this option set, will be included in the SQL scripts.

<options>
<excludeFromSqlGeneration/>
</options>

Initial data provisioning

It is possible to generate a script with initial data for a clean deployment. The SQL Expanders provide an XML representation for the data represented by DataElements that is database-technology agnostic.

More in-depth information can be found on the dedicated page.