Hi,
when I have following field definition in a table:
public final org.jooq.TableField<my.jooq.json.serialize.test.tables.records.
TestRecord, org.joda.time.DateTime> TIME_UTC
= createField("TIME_UTC",
org.jooq.impl.SQLDataType.BIGINT.nullable(false),
this,
null,
new my.jooq.json.serialize.test.converter.
DateTimeConverter());
With following Converter:
public class DateTimeConverter implements Converter<Long, DateTime>
formatJson returns the field definition:
...
"fields":[{"name":"TIME_UTC","type":"BIGINT"},
...
So far so good, as I assumed that jOOQ would use the underlying database
type in order to serialize and deserialize the JSON string easily.
But the data part looks like this:
"2016-06-07T09:00:00.000+02:00"
formatJSON converts the custom data type from the fetched record by using
toString().
(see: org.jooq.tools.json.JSONValue#toJSONString in github
<https://github.com/jOOQ/jOOQ/blob/version-3.8.0-branch/jOOQ/src/main/java/org/jooq/tools/json/JSONValue.java#L135>
)
I expected the json serializer would use the converter to get the database
type back as a Long value.
Afterwards the deserializer is not able to turn the String value to BIGINT
and renders it to a null value.
My question: is this working as expected, is it a bug or is formatJSON not
intended to be used with custom types?
Thanks in advance
Rick
--
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.