-
Notifications
You must be signed in to change notification settings - Fork 16
SQLP 2.4.0 and SQLEP 1.9.4 Tutorial
###The tutorial is updated for SQLP 2.4.0+ and SQLEP 1.9.4+
###Introduction
The new feature of the SQL Processor Eclipse Plugin (SQLEP) version 1.9.4 is the new control directive enum-for-check-constraints
. It can help to reduce the number of generated enumerations. The enumerations are generated based on DB column constraints. The usage is described in SQLP 2.2.0 and SQLEP 1.6 Tut..
It can be, the DB column constraints are the same with the exception they are defined on different tables and/or columns. For example we have the HSQLDB layout
CREATE TABLE PERSON
(
....
GENDER VARCHAR(1) NOT NULL
....
);
ALTER TABLE PERSON ADD CONSTRAINT CHECK_PERSON_GENDER
CHECK (GENDER IN ('M', 'F', '0'))
;
CREATE TABLE CONTACT
(
...
GENDER2 VARCHAR(1)
...
);
ALTER TABLE CONTACT ADD CONSTRAINT CHECK_CONTACT_GENDER2
CHECK (GENDER2 IN ('M', 'F', '0'))
;
The standard SQLEP output is to have 2 generated enumerations PersonGender
and ContactGender2
. To reduce the number of enumerations to one and name it Gender
, we can use
pojogen-enum-for-check-constraints Gender PERSON_GENDER CONTACT_GENDER2;
The first parameter Gender
is the name of the final enumeration. Next there's a list of all DB column constraints, which have the same effective definitions. Ctrl-SPACE
invoked content assist can help to find the correct DB column constraint.
- SQL Processor Home
- SQL Processor News
- SQL Processor Eclipse Plugin Home
- SQL Processor Eclipse Plugin News
- SQL Processor Architecture
- SQLP and SQLM*P Tutorials
- SQLM*P Control directives
- Basic Tutorials
- 10 minutes Tutorial
- Simple Tutorial
- CRUD Tutorial
- Associations Tutorial
- Inheritance Tutorial
- More inheritance Tutorial
- Custom Types Tutorial
- Stored procedures Tutorial
- IDE Setup and Coding Standards
- Catalog (JPA) Sample
- Catalog (Hibernate) Sample
- Catalog (Spring) Sample
- Advanced catalog (Spring) Sample
- The Reference Guide
- The Eclipse Plugin Tutorials
- The Improvements
- Tutorials archive