Hi Dominik,

Thanks for your quick reply. I will comment inline

2016-10-20 14:31 GMT+02:00 Dominik Gruntz <[email protected]>:

> Hi Lunkas,
> thank you very much for your help. The package definition works as you
> described, at least the warning
>
> No packages defined      : It is highly recommended that you provide
> explicit packages to scan
>
> disappeared,
>

Excellent!


> and the build runs with two warnings (where the first ist obvious).
>
> > gradle generateSampleJooqSchemaSource
> :generateSampleJooqSchemaSource
> HHH000181: No appropriate connection provider encountered, assuming
> application
> will be supplying connections
> HHH000342: Could not obtain connection to query metadata : The application
> must
> supply JDBC connections
>
> BUILD SUCCESSFUL
>

Hmm, interesting. I'm not sure if those warnings are really necessary /
correct in Hibernate. jOOQ's JPADatabase uses Hibernate behind the scenes,
and in the past, it was not trivial to get this right as Hibernate keeps
changing these APIs backwards-incompatibly:
http://stackoverflow.com/q/32178041/521799

In any case, I'll try to fix Hibernate API usage in JPADatabase to get rid
of these warnings:
https://github.com/jOOQ/jOOQ/issues/5607

Thanks for letting me know.


> The process also generated artifacts in the specified directory, but no
> artifacts for the defined JPA classes, i.e. file Keys.java is empty but
> Tables.java contains a very long list of tables:
>
> public class Tables {
> public static final QueryStatistics QUERY_STATISTICS =
> com.example.jooq.information_schema.tables.QueryStatistics.
> QUERY_STATISTICS;
> public static final SessionState SESSION_STATE =
> com.example.jooq.information_schema.tables.SessionState.SESSION_STATE;
> public static final Locks LOCKS = com.example.jooq.information_
> schema.tables.Locks.LOCKS;
> public static final Sessions SESSIONS = com.example.jooq.information_
> schema.tables.Sessions.SESSIONS;
> public static final Triggers TRIGGERS = com.example.jooq.information_
> schema.tables.Triggers.TRIGGERS;
> public static final Domains DOMAINS = com.example.jooq.information_
> schema.tables.Domains.DOMAINS;
> public static final Constants CONSTANTS = com.example.jooq.information_
> schema.tables.Constants.CONSTANTS;
> public static final FunctionColumns FUNCTION_COLUMNS =
> com.example.jooq.information_schema.tables.FunctionColumns.
> FUNCTION_COLUMNS;
> public static final Constraints CONSTRAINTS = com.example.jooq.information_
> schema.tables.Constraints.CONSTRAINTS;
> public static final CrossReferences CROSS_REFERENCES =
> com.example.jooq.information_schema.tables.CrossReferences.
> CROSS_REFERENCES;
> public static final InDoubt IN_DOUBT = com.example.jooq.information_
> schema.tables.InDoubt.IN_DOUBT;
> public static final Views VIEWS = com.example.jooq.information_
> schema.tables.Views.VIEWS;
> public static final Collations COLLATIONS = com.example.jooq.information_
> schema.tables.Collations.COLLATIONS;
> public static final ColumnPrivileges COLUMN_PRIVILEGES =
> com.example.jooq.information_schema.tables.ColumnPrivileges.COLUMN_
> PRIVILEGES;
> public static final TablePrivileges TABLE_PRIVILEGES =
> com.example.jooq.information_schema.tables.TablePrivileges.
> TABLE_PRIVILEGES;
> public static final Schemata SCHEMATA = com.example.jooq.information_
> schema.tables.Schemata.SCHEMATA;
> public static final FunctionAliases FUNCTION_ALIASES =
> com.example.jooq.information_schema.tables.FunctionAliases.
> FUNCTION_ALIASES;
> public static final Rights RIGHTS = com.example.jooq.information_
> schema.tables.Rights.RIGHTS;
> public static final Roles ROLES = com.example.jooq.information_
> schema.tables.Roles.ROLES;
> public static final Users USERS = com.example.jooq.information_
> schema.tables.Users.USERS;
> public static final Sequences SEQUENCES = com.example.jooq.information_
> schema.tables.Sequences.SEQUENCES;
> public static final Help HELP = com.example.jooq.information_
> schema.tables.Help.HELP;
> public static final Settings SETTINGS = com.example.jooq.information_
> schema.tables.Settings.SETTINGS;
> public static final Catalogs CATALOGS = com.example.jooq.information_
> schema.tables.Catalogs.CATALOGS;
> public static final TypeInfo TYPE_INFO = com.example.jooq.information_
> schema.tables.TypeInfo.TYPE_INFO;
> public static final TableTypes TABLE_TYPES = com.example.jooq.information_
> schema.tables.TableTypes.TABLE_TYPES;
> public static final Indexes INDEXES = com.example.jooq.information_
> schema.tables.Indexes.INDEXES;
> public static final Columns COLUMNS = com.example.jooq.information_
> schema.tables.Columns.COLUMNS;
> public static final com.example.jooq.information_schema.tables.Tables
> TABLES = com.example.jooq.information_schema.tables.Tables.TABLES;
> }
>
>
> No idea where this information comes from, and no Idea why the annotated
> JPA entity classes do not appear.
>

Hmm, that's really interesting. The way this works is that jOOQ uses
Hibernate to generate an H2 database from your JPA annotated entities. It
then proceeds with "ordinary" generation of content from that H2 database,
including the built-in INFORMATION_SCHEMA. That's a side effect, that is
probably not generally desired. I've created an issue for this:
https://github.com/jOOQ/jOOQ/issues/5608

As a workaround, you can specify the <inputSchema/> configuration to
include only your schema.

Is there no other schema being generated? Are those JPA-annotated entities
on the jOOQ code generator's classpath?


> Btw, the Gradle Plugin I am using is based on jOOQ 3.6.2 (see
> https://github.com/etiennestuder/gradle-jooq-plugin).
>

There are certain limitations that derive from this Gradle Plugin
limitation. I really hope this improvement will make it soon into the
plugin:
https://github.com/etiennestuder/gradle-jooq-plugin/pull/20

It appears that Etienne is very busy with more pressing work at Gradle,
unfortunately. There's always the possibility of falling back to using the
standalone code generator from within Gradle (using the latest jOOQ
version):
http://www.jooq.org/doc/latest/manual/code-generation/codegen-programmatic

or to using Maven instead...

I hope this helps. Thanks again for all your feedback, that's very useful.
If you have any additional questions, please do not hesitate to ask and I'm
very happy to help
Lukas

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to