Support > Repository > Model > Database details

The model is associated with a table in the database. You can set this details.

You can specify "Screen> Other> Database Details".

Figure 1 Database Details

It is enabled by standard.In this case, a table corresponding to the model is created.
If you disable this setting, no tables are prepared.To be precise, we do not issue a CREATE TABLE statement against the utilization database.

It can be used in the following cases.

Even if you do not create a table, the table definition (DDL) will be prepared.The automatically generated DDL file is saved in the following folder.

When creating a table and specifying a physical table name, execute the CREATE TABLE statement with the table name specified here.

If you do not create a table and specify a physical table name, you will be working with the table of the existing system.

Share the same table with different models

When different models A and B are defined respectively, it is assumed that "do not create table" in model B and "specify model A as physical table name", models A and B share the same table I will.

There is a "submodel" in the same mechanism.When setting a submodel, it can be interpreted that Wagby is related to the main model and submodel, so locking and caching are done properly.On the other hand, if you just share the physical table, not submodel settings, such correspondence will not be done.Keep consistency in both models, developers should be careful to do.[More ...]

Schema can not be specified

A physical table name can not contain a schema.

As an alternative, there is a method used by the "synonym" of the database.For example, in Oracle, there is a mechanism to use a synonym to handle a table of another schema as a table of aliases.For details, please refer to the manual of your database.

Wagby caches values ​​read from the database in memory.This reduces the number of database operations and improves performance.Caching is enabled by default.

When this setting is invalidated, it always operates the database to acquire the latest data.Since performance is affected, we recommend that you enable caching for no reason.

Periodically erase model cache information

You can periodically clear model cache information using jobs.

Cache between 1 requests7.9

Even if you disable caching, interactions with the database that occurred during one request (communication between the web browser and the web server) are cached in memory.This cache will be cleared automatically when you return the response.Although the cache validity period is very short, it leads to some performance improvement.

You can also disable this "cache between one request".In this case, we will always read the values ​​from the database.

Definition method

When you uncheck "Enable Cache" in "Screen> Other> Details of Database", further check "Disable Database Cache Perfectly" in "Java Source Code Setting".(Since it is not checked by the standard, caching between requests is enabled.)

Figure 2 Disabling database caching completely

Wagby is standard, and it sets up the delimiter of the identifier in the SQL sentence. For details, please read "environment> database> identifier delimiter".

Please read "Locking method".

The points to note when reusing existing tables are summarized.

trouble shooting

Handling of mandatory items

In the model defined by Wagby as "required", actually check whether NULL exists on existing table (or view) side.Since Wagby assumes that NULL does not exist in essential items, if NULL is found, data can not be acquired correctly and an error will result.

Handling date type items

You may have defined a date as a string in an existing table.Example: 8 characters of yyyyMMdd.In this case, you can only use Wagby's model definition as a character string, but date type range search and calendar auxiliary input function can not be used.As a workaround, consider defining the view of the existing table and consider replacing it from the string with the date type using the functions of the database.If it is a date item in the view, Wagby's date type will be available.