8. Generating Domain Model from an existing database


There may be occasions where a data model already exists, and you don't want to implement the domain model with Skyway. This can occur when the data model was defined by a different group (not using Skyway Builder) or when building on top of an existing application. In either case, you need a way to leverage the pre-existing data model from Skyway Builder.


In Skyway Builder there are essentially two ways implement a data model in a Skyway solution: natively and externally. Using the native approach, the data model is defined in Skyway Builder, and Skyway Builder produces the database table definitions for any supported database management system. Using the external approach, define the data model in a relational database and import the table definitions into Skyway.


Using externally defined tables is accomplished using the Import Types wizard, which can be accessed from the Database Configuration tab in the Data Access Object Editor. Once the domain objects are discovered, they can be used just like domain objects created in Skyway.

Here are the general steps for importing domain objects:

Steps For Importing Types

  1. Create Data Access Object - In a Skyway Project create a data access object that will represent your external database.

  2. Configure DB Connection - Switch to the Database Configuration tab of the Data Access Object you created, and specify the database connection (in the Database Information section) that contains the tables you want to import. If the a database connection hasn't been defined, you must create the database connection using the Database Explorer, and the specify the connection.

  3. Activate the Import Types wizard - Click on the Import Types link from the Activities panel of the Database Configuration tab.

  4. Select the schema - The schema dropdown will show a list of schemas available from the database connection. Select the schema that contains the tables that should be imported.

  5. Select the dialect - The dialect dropdown will show a list of dialects supported by Skyway Builder. Select the dialect that matches your database.

  6. Select the tables to import - From the tables grid, select the tables that you want to import into the Skyway Builder project.

  7. Click Finish - Skyway Builder will analyze the tables and create the domain objects corresponding the tables that were imported.