Skip to content

SQLEP 1.7.4 Tutorial

Vladimír Hudec edited this page Nov 24, 2013 · 8 revisions

###The tutorial is updated for SQLEP 1.7.4+

###Introduction The new features of the SQL Processor Eclipse Plugin (SQLEP) version 1.7.4 are

  • new control directive database-take-comments
  • default DAO constructor
  • new control directive pojogen-generate-validation-annotations
  • extended POJO grammar - implements directive with exceptPojos and onlyPojos
  • extended DAO grammar - implements directive with exceptDaos and onlyDaos

Tables and columns comments

It's possible to take comments in DB into generated pojo.qry using the new control directive

database-take-comments;

In can be seen in the HSQLDB based sample [https://github.com/hudec/sql-processor/blob/master/simple-samples/simple-hsqldb/src/main/resources/pojo.qry]

Validation annotations

It's possible to generated some validation annotations in pojo.qry using the new control directive

pojogen-generate-validation-annotations;

For the NOT NULL database columns (=required attributes) the annotation javax.validation.constraints.NotNull is taken. For the VARCHAR database columns the annotation javax.validation.constraints.Size with the max length is taken. In can be seen in the HSQLDB based sample [https://github.com/hudec/sql-processor/blob/master/simple-samples/simple-hsqldb/src/main/resources/pojo.qry]

The generated annotations can help in the process of dynamic input form validations - the new SQLP 2.2.5 experimental feature.

Extended POJO grammar

Using for example in pojo.qry the next directive

implements java.io.Closeable

we can force all generated POJO classes have to implement this interface. Now we can restrict the feature only for selected POJOs using

implements java.io.Closeable onlyPojos Pojo1 Pojo2

or we can use a negative selection

implements java.io.Closeable exceptPojos Pojo1 Pojo2

The same is true for the directive extends

extends java.lang.Object onlyPojos Pojo1 Pojo2

or

extends java.lang.Object exceptPojos Pojo1 Pojo2

Extended DAO grammar

Using for example in dao.qry the next directive

implements java.io.Closeable

we can force all generated DAO classes have to implement this interface. Now we can restrict the feature only for selected DAOs using

implements java.io.Closeable onlyDaos Dao1 Dao2

or we can use a negative selection

implements java.io.Closeable exceptDaos Dao1 Dao2

The same is true for the directive extends

extends mypackage.BaseDao onlyDaos Dao1 Dao2

or

extends mypackage.BaseDao exceptDaos Dao1 Dao2
Clone this wiki locally