2013/10/8 Eric Schwarzenbach <[email protected]>

> It seems that the field that DSL.fieldByName methods return always reports
> java.lang.Object for getType (and, um, "other" or some such for
> getDataType()).
>
> Is this a bug?
>

If you know the data type of a Field, you can pass it to any of these:

- 
http://www.jooq.org/javadoc/latest/org/jooq/impl/DSL.html#fieldByName(java.lang.Class,
java.lang.String...)
- 
http://www.jooq.org/javadoc/latest/org/jooq/impl/DSL.html#fieldByName(org.jooq.DataType,
java.lang.String...)


> Or is there some notion I'm missing of where information from the
> generated code is and isn't used?
>

I'm not sure how your question relates to type information from generated
code...? Could you explain, please?


> If it's not, for some reason, reasonable to expect DSL methods to make use
> of information from that code generation perhaps there should another layer
> in the class hierarchy for Fields that aren't typed?
>

Unfortunately, in many SQL dialects and JDBC implementations, Fields will
need type information as ResultSet.getObject() and more importantly,
PreparedStatement.setObject() doesn't work as well as one would hope. Some
insight on that topic can be seen here:
http://blog.jooq.org/2011/08/31/rdbms-bind-variable-casting-madness/

In other words, Fields are always typed. If the type is unknown, you may
try your luck with Field<Object> / SQLDataType.OTHER / Types.OTHER and hope
that the JDBC driver and database can handle this.

Hope this helps,
Lukas

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