Hello,

This issue is now finally fixed in jOOQ 3.1:
https://github.com/jOOQ/jOOQ/commit/591afd7fcb3ad1796ed9b90c8331d5a46289af47

org.jooq.EnumType now references an optional Schema, which is used for
casting enum bind values to the fully qualified type.

This fix will not be merged to earlier versions, as it compatibly modifies
the API. In earlier versions, you might inline bind variables, however, to
circumvent this issue

Cheers
Lukas


2013/1/30 Lukas Eder <[email protected]>

> Hello Marcel,
>
> Thanks for reporting this. I have registered #2135 for this bug:
> https://github.com/jOOQ/jOOQ/issues/2135
>
> Indeed, it should be possible to place enums outside of the public schema.
> This isn't implemented correctly in jOOQ.
>
> Cheers
> Lukas
>
>
> 2013/1/25 <[email protected]>
>
> Hello
>> ,
>> I have the following schema
>>
>> /* ----------------------------------
>>  * Clear and create schema
>>  * ----------------------------------
>>  */
>> DROP SCHEMA IF EXISTS  myschema CASCADE;
>> CREATE SCHEMA myschema;
>>
>> /* ----------------------------------
>>  *  Enumeration: testenum
>>  * ----------------------------------
>>  */
>>  DROP TYPE  IF EXISTS  myschema.testenum;
>>   CREATE TYPE myschema.testenum AS ENUM ('val1', 'val2', 'val3');
>>
>> /* ----------------------------------
>>  * Table: base object
>>  * ----------------------------------
>>  */
>> CREATE TABLE myschema.table1 (
>>     id int8 NOT NULL,
>>       enumval   myschema.testenum,
>>
>>     CONSTRAINT primary_base_object PRIMARY KEY (id)
>> );
>>
>> I have generated the classes with jOOQ.
>> The enum looks as follows:
>>
>> public enum Testenum implements org.jooq.EnumType {
>>     val1("val1"),
>>
>>     val2("val2"),
>>
>>     val3("val3"),
>>
>>     ;
>>
>>     private final java.lang.String literal;
>>
>>     private Testenum(java.lang.String literal) {
>>         this.literal = literal;
>>     }
>>
>>     @Override
>>     public java.lang.String getName() {
>>         return "testenum";
>>     }
>>
>>     @Override
>>     public java.lang.String getLiteral() {
>>         return literal;
>>     }
>> }
>>
>> So there is no information about the schema "myschema". As it is for the
>> generated table class.
>>
>> The following insert fails:
>>
>> Factory f = new Factory(con, SQLDialect.POSTGRES);
>> f.insertInto(Table1.TABLE1).values(f.val(1), Testenum.val1).execute();
>> Result<Record> result = f.select().from(Table1.TABLE1).fetch();
>> System.out.println(result);
>>
>> Error:
>>
>> SQL [insert into "myschema"."table1" ("id", "enumval") values (?,
>> ?::"testenum")]; FEHLER: Typ »testenum« existiert nicht
>>
>> (Error message from German to English: "ERROR: Type »testenum« does not
>> exist")
>>
>> If I move "testenum" is in the public schema, everything is fine!
>>
>> Now my question: Is there the possibility to add schema information to
>> the enum type?
>>
>> Regards,
>> Marcel
>>
>>
>>
>

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


Reply via email to