JOOQ offers this:
*
"jooq-codegen configuration"
  <!-- Annotate POJOs and Records with JPA annotations for increased
       compatibility and better integration with JPA/Hibernate, etc
       Defaults to false -->
  <jpaAnnotations>false</jpaAnnotations>
*
"Generated or custom POJO's instead of jOOQ's Records"
        If you're using jOOQ along with Hibernate / JPA, or if you want to
use your
        own, custom domain-model instead of jOOQ's Record type-hierarchy, you
can
        choose to select values into POJOs. Let's say you defined a POJO for
authors:
But, I want this:

I would like to INTEGRATE my domain class, the validation/restrictions
declaration (annotations) of that class,
and the persistence metadata (annotations) of that class in one place:
the SAME domain class.
[Yes, I know it: it breaks OO's principles of separation of concepts
and layers]

I would like that JOOQ metamodel generator takes that domain class,
analize it, and generate
the corresponding JOOQ classes, based on the presistence annotations.
So, there will NOT be
connection to a database.
[Yes, I know it: this breaks JOOQ's philosophy of "db is the the first
one"]

For the validation/restrictions declaration I was think in Bean
Validation (JSR 303), although it's
a transparent thing for this situation.
For the persistence metadata, I was think in JPA 2.0 (JSR 317),
although I would serve any basic
annotation of kind of @Table, @Column, etc. It would be a simplified
JPA: no @Entity, no @ManyToMany,
etc. We need the minimal information to generate the JOOQ metamodel.

Advantages:
* Declaration of validation, persistence, and model in a unique place.
Therefore:
** Development productivity enhancement, because all relevant code is
localized in one place, and apporting very little information.
** Bugs and errors (due to software layers synchronization
maintenance) probability reduction.
Disadvantages:
* Class model without inheritance.
* Class model relations are solely 1:1.


CONCLUSSION:

It would possible implements an option in JOOQ that let to generate
the metamodel directly from JPA annotations in classes, without
connecting with DB?
Or, better: It would be possible to check both sides: annotations
and DB schema! If there would be differences, then generator alerts
to user!

Reply via email to