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
- Open the model for your JEE application.
- Go the to settings tab.
- Add a new expansion resource with name
net.democritus:sql-expanders
and version4.2.0
.
Project files
- 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 nameexpansionSettings.xml
. - Add a child element to
expansionResources
as follows:<expansionResource name="net.democritus:sql-expanders" version="4.2.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
.
Application
ApplicationInstance
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>
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.