Hi,
currently we're evaluating the use of jOOQ for a new project.
We're facing two issues for JUnit testing.
Setting- We use the gradle jooq plugin for code generation with a PostgreSQL database as source. This database is initially filled by liquibase-scripts.
- We use an HSQL-Spring-embedded-database for unit testing. Here we configured jooq to use the HSQLDB dialect at runtime.
- We try to mimic the PostgreSQL syntax with the HSQLDB by executing "SET DATABASE SQL SYNTAX PGS TRUE;" on startup.
- Versions:
First issueWhen executing a query the following exception is thrown:
org.jooq.exception.DataAccessException: SQL [select "public"."person_example"."name", "public"."person_example"."age" from "public"."person_example" limit ? offset ?]; invalid schema name: public
at org.jooq.impl.Utils.translate(Utils.java:1158)
at org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:495)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:325)
at org.jooq.impl.AbstractResultQuery.fetch(AbstractResultQuery.java:324)
at org.jooq.impl.SelectImpl.fetch(SelectImpl.java:1034)
[...]
When I manually rename the name for the public schema to "PUBLIC" (in org.jooq.generated.Public), this issue seems to be resolved. So it seems to be a problem with case-sensitivity. Is there a better solution?
Second issueWhen the first issue is manually resolved, this exception is thrown:
org.jooq.exception.DataAccessException: SQL [select "PUBLIC"."person_example"."name", "PUBLIC"."person_example"."age" from "PUBLIC"."person_example" limit ? offset ?]; user lacks privilege or object not found: person_example
at org.jooq.impl.Utils.translate(Utils.java:1158)
at org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:495)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:325)
at org.jooq.impl.AbstractResultQuery.fetch(AbstractResultQuery.java:324)
at org.jooq.impl.SelectImpl.fetch(SelectImpl.java:1034) [...]In Liquibase we explicitly stated to insert into the schema "PUBLIC". Since the database is only created on the fly, it is hard to see its real content...
Any idea on that?
For our better understanding: Is the code generated by the code-generator somehow database-specific or generic?
Thanks a lot!
Eugen
PS. Are there news on putting the gradle jooq generator into a jooq release?