Generating the initial database data for deployment

Use the Database Schema Tool's insert command to generate an SQL script for inserting system default data into a database.
The insert command reads the system default data or serialized class instance data from a specified dump file, then generates an SQL script that inserts this class data into the appropriate tables as defined by the persistence mapping.
CAUTION: Only insert data if it does not already exist in the database, otherwise the insert will fail. If the insert fails because data already existed in the database, the duplicate data will need to be deleted from the model before proceeding. To delete data, use the truncate command. For more information about using the truncate command, see the NexJ Studio Developer Guide.

To insert data into a database from a dump file:

  1. In NexJ Studio, click the arrow next to the Run Tool button and select Database Schema Tool.
    The Database Schema Tool opens.
  2. In the Model section, choose the model that you want to insert data from:
    • For the currently loaded model, shown in the label, select Current.
    • For a base model in your Model Library, select Base Model and select one of the available models from the drop-down list.
    • For a previously published model in your file system, select Published Model JAR and click the Browse button to locate the published model. You might be prompted to specify the directory where the published model's mixins are located.
  3. Specify the server and connections that you want the application to support when running with this database.
    1. In the Server field, specify either the server or environment file that contains the server configuration information you want to use when setting up the database. If you specify an environment file, then it will also include the connections information.
    2. In the Connections field, specify the connections file that you want to use when setting up the database. If you previously selected an environment file in the Server field, then it already has the connections information, and this field becomes inactive.
    Note: If you are setting up the database for the current model, then the fields allow you to select from among the environment, server, and connection files within the model. If you are creating a schema for a base or published model, then your choice is limited to only those server and connection files contained in your global environment folder.
  4. In the Command field, select insert.
  5. In the Data Source field, select the data source that you want to insert data into.
    Selections are limited to the model's relational data sources.
  6. In the Output Directory field, click the Browse button , specify where you want to save the resulting SQL file, and click OK.
  7. Optional: If you want to specify an owner prefix for your tables, enter it in the Owner field.
    This field refers to the metadata table owner value. If you leave the field blank, a default value of dbo is used.
  8. Click Run.
The tool outputs a script file to the specified directory called modelname_datasourcename_insert.sql, where modelname is the name of the chosen model and datasourcename is the name of the chosen data source.