Support > Repository > Model definition > Database details
ja | en

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.

Reuse tables of existing systemsIn case,Prepare a view instead of a tableCan be used in such 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.

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.

Setting 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, refer to "Environment> Database> Identifier delimiterPlease read.

"Lock methodPlease read.

The points to note when reusing existing tables are summarized.

  • Invalidate "Create table" and describe the existing table (or view) name in "Physical table name".
  • Make the items in the model the same as those of the existing table (or view).Also specify physical column name and typecan do.
  • For performance reasons, Wagby's cache should be as valid as possible.How to recreate Wagby's cache on a regular basis if existing tables are updatedthere is.OrMaterialized viewHow to use is also effective.
  • If the existing table is read-only, you do not need to consider locking.If existing tables are also updated from Wagby and there is a possibility that they may be updated also from existing systems, in order to avoid conflicting updates,Consider lockit is necessary.Wagby's optimistic lock can be used if the existing table supports optimistic locking and has "version control column".If not, please consider sharing Wagby's pessimistic lock table with existing systems.Handling of lock depends on business requirements, so at actual design timeConsultation to Wagby expert certified technicianPlease give me.

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.