I try to generate code from JPA entities using the "database" 
org.jooq.util.jpa.JPADatabase, but I am working with the JOOQ-Gradle-Plugin 
provided by Etienne Studer (
https://github.com/etiennestuder/gradle-jooq-plugin).


The question is how the list of packages containing the JPA entities can be 
specified. I have tried the following specification:

jooq {
    sample(sourceSets.main) {
        generator {
            name = 'org.jooq.util.DefaultGenerator'
            strategy {
                name = 'org.jooq.util.DefaultGeneratorStrategy'
            }
            database {
                name = 'org.jooq.util.jpa.JPADatabase'
                packages = 'com.example.jpa'
            }
            generate {
            }
            target {
                packageName = 'com.example.db'
                directory = 'src/main/java'
            }
        }
    }
}

 If I use the following definition, then Gradle prints the following error 
message:

* What went wrong:
A problem occurred evaluating root project 'spring-gs-jooq'.
> Invalid property: 'packages' on extension 
'jooq.sample.generator.database', value: com.example.jpa

and if I drop the package property altogether then I get (as expected) the 
warning

No packages defined      : It is highly recommended that you provide 
explicit packages to scan

followed by the exception

org.jooq.exception.DataAccessException: Error while exporting schema
        at org.jooq.util.jpa.JPADatabase.create0(JPADatabase.java:111)
        at org.jooq.util.AbstractDatabase.create(AbstractDatabase.java:209)
        at org.jooq.util.AbstractDatabase.create(AbstractDatabase.java:201)
        at 
org.jooq.util.AbstractDatabase.getDialect(AbstractDatabase.java:183)
        at org.jooq.util.JavaGenerator.generate(JavaGenerator.java:209)
        at org.jooq.util.GenerationTool.run(GenerationTool.java:426)
        at org.jooq.util.GenerationTool$run.call(Unknown Source)


Any help is appreciated.
Thanks!
Dominik

-- 
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