-
Notifications
You must be signed in to change notification settings - Fork 16
SQLP 2.2.1 and SQLEP 1.7 Tutorial
###The tutorial is updated for SQLP 2.2.1+ and SQLEP 1.7+
###Introduction The new features of the SQL Processor (SQLP) version 2.2.1 and the SQL Processor Eclipse Plugin (SQLEP) version 1.7.0 are
- extended POJO grammar for annotations
- annotations for POJO constructors
- annotations for generated POJO metods
- annotations for generated POJO static fields attributes
- in annotations also reference to POJOs
- improved SQLP exception logging
- input values modifiers prefix !
- new modifier !empty
- modifier anyset = any
- first approach to establish complex web application
- simple-backend based on Spring, SQLP and extdirectspring
- simple-gui based on Ext JS
- new control directive preserve-foreign-keys
###Improved annotations The complete set of annotation is
- @ - a POJO class annotation
- @@ - a POJO constructor annotation
- @@@ - a POJO static attributes annotation
- @@@@ - a POJO overloaded methods annotation
- @ - an attribute annotation
- @@ - an attribute getter annotation
- @@@ - an attribute setter annotation
In the annotations the references to another entities can be used, as in the following snippet
@ModelAssociation ::: value :ModelAssociationType BELONGS_TO, model ::Person class
The complex sample can be seen at https://github.com/hudec/sql-processor/blob/master/simple-samples/simple-backend/src/main/resources/pojo.qry.
In the case of any SQLP exception in the runtime the SqlProcessorException
can contain the failed ANSI SQL command. It can be controlled using the option feature LOG_SQL_COMMAND_FOR_EXCEPTION
. For the case of
- false (a default value), the exception is seeded with the failed command
- true, the failed command is only logged
###Improved modifiers
The basic tutorials regarding the input value modifiers can be seen at Input Values. Now for all modifiers the prefix !
can be used. It's meaning is the negation of the original modifier. At the same time a new modifier !empty
was established. The typical usage is the next one
DELETE_CONTACT(CRUD,inx=Contact,outx=Contact,tab=contact)=
delete from %%CONTACT
{= where
{& %ID = :id(!empty) }
{& %VERSION = :version(!empty) }
}
;
###The modifier anyset
The modifier anyset
was introduced in SQLP-2.1.1-and-SQLEP-1.5-Tutorial. Now also the modifier any
can be used for the same purpose.
###The foreign key in POJO
For the association many-to-one in the POJO the attribute is of related class type. In some cases we want to establish also the attribute, which is in fact the foreign key. For example in the definitions.qry
we have
pojogen-preserve-foreign-keys CONTACT;
In the generated pojo.qry
we have
person :: Person updateCol id->personId
personId : java.lang.Long createCol person->id
And in the generated Java class we have the following code
private Person person;
public Person getPerson() {
return person;
}
public void setPerson(Person person) {
this.person = person;
if (this.person != null)
this.personId = this.person.getId();
}
public Contact withPerson(Person person) {
this.person = person;
if (this.person != null)
this.personId = this.person.getId();
return this;
}
private Long personId;
public Long getPersonId() {
return personId;
}
public void setPersonId(Long personId) {
this.personId = personId;
if (this.person == null)
this.person = new Person();
this.person.setId(personId);
}
public Contact withPersonId(Long personId) {
this.personId = personId;
if (this.person == null)
this.person = new Person();
this.person.setId(personId);
return this;
}
###The new web application sample This sample is still in the process of development. The sample can be seen at
- 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