Skip to content

Guide Step 2 DB Model

Laurent GUERIN edited this page Nov 10, 2017 · 31 revisions

Telosys User Guide - Step #2 - DB Model

This step describe how to create a new model from an existing database.

Before continuing ensure your home directory is defined and the project has been initialized.

Configure your database

Edit the databases.dbcfg XML file to define a new database configuration.

Launch the external editor with the edb (Edit DB) command in Telosys-CLI or if you are in your prefered editor (Atom, VSCode, etc) just open the databases.dbcfg file.

In databases.dbcfg add a new <db> tag with all the expected information (use the examples of databases configuration available in the commented lines of the file).

For each database you must define the following attributes :

  • id an integer that identifies the database (from 0 to N)
  • name the database name (just for information, you can use any name)
  • driver the JDBC driver class name
  • url the JDBC URL to access the database

If you plan to generate code for JPA also define :

  • typeName the type of database (eg "POSTGRESQL", "DERBY", "H2", "ORACLE", etc)
  • dialect the JPA dialect (eg "org.hibernate.dialect.MySQLDialect")

Set the following JDBC properties ( in a <property> tag ) :

  • property name user the database user
  • property name password the database user's password
  • if necessary any other JDBC specific properties required by your database

Define the following information used to retrieve the JDBC METADATA ( in the <metadata> tag ):

  • catalog the database catalog to be used if any ("" for void, "!" for null)
  • schema the database schema containing the tables you want to use ("" for void, "!" for null)
  • table-name-pattern the pattern to filter the tables names (eg "%" for all tables )
  • table-types the type of tables to be used (eg "TABLE VIEW", "TABLE", "VIEW")
  • table-name-exclude a pattern to exclude some tables
  • table-name-include a pattern to include some tables

Generate your model

Clone this wiki locally