Thank you, doing the explicit "select().from()" did the trick.
May I kindly ask how to perform a "SELECT * ..." using this approach?
Indeed, that is what I want to achieve with my query (but trimmed off some
parts to make it more readable). Now I am doing the select on all four
columns of the table, but maybe a "SELECT *" would also be more robust in
my case.
One remark: do you think it is smart to have all those overloaded methods
(for J5+)? Especially since varargs. It makes thinks (in code completion)
hard to read, JavaDoc bloatet, etc.. Also, now I may have to import a
Record2, a Record4, a Record5, and what if at any time I would need a
Record326?
Am Freitag, 7. Juli 2017 21:09:48 UTC+2 schrieb Bjoern Wuest:
>
> 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.