arrow_back history picture_as_pdf This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ~~Title: Considering Check Constraints From the Database~~ In addition to the use of [[jvx:server:storage:dbdefault_values|Default Values]], the restriction to **"allowed values"** is another advantage of JVx. The "allowed values" for columns are usually defined in the database using check constraints. These are evaluated by JVx and assumed as allowed values. The constraints directly impact the user interface, as the user is only offered the allowed values in the form of choice cell editors. == Example == Based on the example for [[jvx:server:storage:dbdefault_values|Default Values]], we define the following check constraints (Oracle Syntax): <file sql> alter table USERS add constraint USER_ACTIVE_CHECK check (active IN ('Y', 'N')); alter table USERS add constraint USER_CHANGE_PASSWORD_CHECK check (CHANGE_PASSWORD IN ('Y', 'N')); </file> Therefore, the fields "ACTIVE" and "CHANGE_PASSWORD" can only contain "Y" or "N". So that in the user interface the correct choice cell editor is used, this must be defined. This is done globally by calling: <file java> UIChoiceCellEditor.addDefaultChoiceCellEditor(editor); </file> A choice cell editor from the ApplicationUtil has already defined the values "Y" and "N". The following methods can be used to disable the check constraints detection: <file java> //per instance users.setAllowedValues(false); //for all instances (static) DBStorage.setDefaultAllowedValues(false); </file> If no check constrains are used in the database, the allowed values can be set via the API: <file java> users.open(); //sets allowed/possible values users.getMetaData().getColumnMetaData("ACTIVE").setAllowedValues(new Object[] {"Y", "N"}); </file>