Thanks, Stéphane!
Since we are using Spring, I created a class JooqConfiguration that extends
org.jooq.impl.DefaultConfiguration and included it as Spring bean. There I
could now set the Settings. Great.
Concerning the HSQLDB, we're now considering having every deloper setting
up a local PostgreSQL db only for testing. This speeds things up since the
liquibase scripts do not need to be run for every test run.
Eugen
Am Mittwoch, 13. November 2013 17:20:03 UTC+1 schrieb Stéphane Cl:
>
> Hello,
> I do similar things except that I test on H2.
> Disabling Schema rendering helped a lot, here's my code, you may need to
> adapt it a bit since it's targeting jooq 2.6 :
>
> Connection conn =
> DriverManager.getConnection("jdbc:h2:mem:test;DATABASE_TO_UPPER=false;MODE=PostgreSQL",
>
> "user", "password");
> RunScript.execute(conn, new FileReader( appDirectory +
> File.separator + "conf" + File.separator + "baseh2.sql"));
>
> Settings settings = new Settings()
> .withRenderSchema(false);
>
> sqlFactory = new Factory(conn, SQLDialect.H2, settings );
> //do stuff with factory
>
> Hope it helps
>
> Le mercredi 13 novembre 2013 12:25:12 UTC+1, [email protected] a
> écrit :
>>
>> 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:
>> - jOOQ: 3.2.0
>> - HSQLDB: 2.3.1
>>
>>
>> *First issue*
>>
>> When 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 issue*
>>
>> When 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?
>>
>
--
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/groups/opt_out.