I think this is a bug.

Have following table definition:

    public final static Table TableName = DSL.table(DSL.name(
CEntityCarPostingLink.class.getSimpleName()));
    public final static Field<CUUID> ObjectID = DSL.field(DSL.name(
"ObjectID"), SQLDataType.BLOB.nullable(false).asConvertedDataType(new 
CUUIDConverter())); private final CUUID m_ObjectID;
            JooqContext.createTableIfNotExists(TableName)
                .column(ObjectID)
                .constraints(DSL.constraint(TableName.toString() + "_" + 
ObjectID.toString()).primaryKey(ObjectID))
                .execute();


The code for the converter is:

public final class CUUIDConverter implements Converter<byte[], CUUID> {
    @Override public CUUID from(byte[] T) { return T == null ? null : new 
CUUID(T); }
    @Override public byte[] to(CUUID U) { return U == null ? null : U.bytes
(); }
    @Override public Class<byte[]> fromType() { return byte[].class; }
    @Override public Class<CUUID> toType() { return CUUID.class; }
}


When writing to the database, i.e. doing insert or update, I feed an 
instance of CUUID and Jooq converts it to a byte-array and writes to 
database.

Yet, when reading from database, I get a ClassCastException.

In the debugger I think I pinpointed to

...
42 package org.jooq.impl;
...
113 @SuppressWarnings({ "rawtypes", "unchecked" })
114 abstract class AbstractRecord extends AbstractStore implements Record {
...
222
223    @Override
224    public final <T> T get(Field<T> field) {
225        return (T) get(indexOrFail(fieldsRow(), field));
226    }
227
...

Shouldn't the get-Method invoke the Converter / Binding assigned to the 
field, instead of doing simply a cast to T?


Best
  Bjoern

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