Support > Repository > Features of Designer/Other tools > Generate repository from existing table definition
ja | en

We will explain how to semi-automatically generate Wagby's repository (design information) from table definition of existing system.

You can read the table definition information from the existing system relational database and semi-automatically generate the Wagby repository. The following information can be read.

  • table name
  • item name
  • Item type
  • Foreign key

All databases supported by Wagby can be used.It also supports Microsoft Access MDB files.

This tool is not shipped as standard with the product.Please download from here.

Installation method

Extract it to the misc folder of Wagby installation folder (Wagby - 7.xx).The following files are extracted (in the misc folder).

  • RepositoryConverterCUI.jar
  • conf\config.properties
  • lib\hsqldb.jar
  • lib\jackcess-2.1.2.jar
  • lib\ucanaccess-3.0.2.jar

Installation is complete.

JDBC driver file placement

In Wagby - 7.xx \ customize \ tomcat \ lib, add the JDBC driver file for the target DBOnly oneto place.

Note: There is only one file to put.

Edit config.properties

Edit conf \ config.properties.Here is an example.

Driver = org.postgresql.Driver url = jdbc: postgresql: // localhost / wagbydb user = postgres password = postgres

For each of the above parameters, specify an appropriate value.

To generate a repository from a Microsoft Access file, follow the procedure below.

JDBC driver file placement

You do not need.

Edit config.properties

Edit conf \ config.properties.Here is an example.

Driver = url = jdbc: ucanaccess: // C: /Users/YOURNAME/Desktop/testdb/testdb_j.mdb user = password =

Driver, user, password are blank.Url specifies the location of the file directly after jdbc: ucanaccess:.

Execution

Double click on RepositoryConverterCUI.jar from the file explorer. It shuts silently but logs are output to the logs folder.

Or, let me run it from the console.The procedure is as follows.

  1. Open the DOS prompt.
  2. Go to the Wagby-7.xx \ misc folder.
  3. Execute the following command.
    java -jar RepositoryConverterCUI.jar
  4. A message is output to the console and the logs folder and it ends.

Confirmation

Start Designer.(If it is running, reload the repository.)

  • The type determines "character" "number" "date" "model reference (search)".Model reference is valid for foreign key specification (foreignkey).
  • Use DB column size for judgment materials.If ten characters or less, tips are issued in the input field.If it is a string type and it is more than 255 characters, it is treated as a text area.
  • In the case of floating point type, if there is digit number information, it is used and it is reflected in the input format.
  • Determine the NOT NULL constraint.
  • For the date type, specify the function TODAY as the initial value when opening the registration screen and the function NOW as the date time type.
  • When model ID (English) and item ID (English) are Japanese, "modelXX" and "itemXX" are automatically set respectively.
  • When model ID (English) and item ID (English) do not match Wagby's named rule, "modelXX" and "itemXX" are automatically set respectively.
  • All foreign keys will be "model reference (search)", but in reality there are cases where it is appropriate to treat it as a repeating container or a foreign key (parent-child model relation).Since it can not be determined automatically, developers should review these structures appropriately.
  • The same applies to "model reference (search)" in case of compound key.
  • Japanese may be set as model ID or item ID.Please correct these manually and replace them with alphanumeric characters.
  • Please correct input check, output format etc. properly.

Do not reflect the NOT NULL specification of the migration source table (to Wagby)7.8

If the migration target table is NOT NULL DEFAULT, all definitions after capture will be mandatory.

To avoid this, you can write it in config.properties as follows.

IgnoreNotnull = model ID, model ID, ..

More than one model ID part can be listed, separated by commas.It also interprets regular expressions.The model ID described here skips the NOT NULL phrase.

Although this is not treated as a required item in Wagby, since the real table is NOT NULL, it is necessary to add processing that replaces it with blanks even if it is entered as an empty field.

With this tool (RepositoryConverter), the project is alwaysIt is treated as new. When applying to the project under development, do as follows.

  1. Back up the project (repository) under development.
  2. Create a model definition from the existing DB with RepositoryConverter.It will be a new project at this timing.
  3. The prepared model definition is generated as "model ID name = folder name" under repository/trunk.So copy the necessary folders to the work folder (prepared in advance).
  4. Read the repository that was backed up in the first step (restore).
  5. Copy the folders saved in work to repository/trunk.Note: Make sure there are no folders with the same name already.You can not copy folders with the same name.Please change the model ID at the timing of 3..
  6. Reload the repositoryto hold.

For models corresponding to existing DBs,Set as sub databaseWould be nice.

For reading Microsoft Access files, open source UCanAccess We are using.