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());
public class DateTimeConverter implements Converter<Long, DateTime>
...
"fields":[{"name":"TIME_UTC","type":"BIGINT"},..."2016-06-07T09:00:00.000+02:00"
--
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 jooq-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thanks, I understand the issue.But keep in mind, that the main issue in serialization and deserialization of jOOQ Records is the aforementioned use of toString as a last resort.toString will yield in almost any case to serialized (json) data which is not deserializable anymore, as user types usually don't have a string based constructor.
So I would suggest to go with sql datatypes <T>.Here the value of the user type <U> needs to be converted back to <T> during format json.Then serialize the known sql datatype to json.In this case json would have BIGINT with the Long value.
Thanks for your support!Yes, at least it would work as expected when implementing the SPI on my own.But as you mentioned SPI, I second-guessed, if it makes sense at all to implement a JSON de/serializer in jOOQ.Finally you would find yourself building a jOOCKsen JSON library!?
In my use-case using jOOQ to serialize and deserialize was quite too hasty.
Maybe a library which excels on the matter of JSON de-serialization is the right tool.
Apart from the missing custom data type serialisation support, was there anything else you found missing?
Maybe a library which excels on the matter of JSON de-serialization is the right tool.Maybe. But that might mean a lot of extra work in the "default" use-case, which is to store some data as JSON (or CSV, etc.) and then load it again using the Loader API.
See, there are always "expert" tools for specific domains like serialisation. But if you ever worked with SQL Developer (or a similar SQL client), didn't you appreciate the fact that there was some out-of-the-box CSV export from time to time?
Often, that's good enough, especially if the serialised format is not that important to you (i.e. if it's perfectly fine if jOOQ fully controls it).
Apart from the missing custom data type serialisation support, was there anything else you found missing?So far I didn't find any obvious functionality missing.
, I implemented a intermediate custom solution (see github). The CustomDatatypeProcessor takes a java.nio.file.Path, reads it and converts record data based on the TableRecord -> Fields -> Converter. Reusing will need some changes, mainly in the coerce() method, but maybe this will help someone who stumbles upon this thread.