ResultSet failed to load JsonObject with custom type
glassfox opened this issue · 3 comments
glassfox commented
Version
4.2.0
Context
- The data loaded into ResultSet from MySql and contain custom type values
LocalDate
.
In try toResultSet.toJson()
and thennew ResultSet(JsonObject)
got exception.
Following the exception:
java.lang.IllegalStateException: Illegal type in Json: class java.time.LocalDate
at io.vertx.ext.sql.ResultSetConverter.lambda$1(ResultSetConverter.java:52) ~[classes/:?]
at io.vertx.ext.sql.ResultSetConverter.fromJson(ResultSetConverter.java:50) ~[classes/:?]
at io.vertx.ext.sql.ResultSet.<init>(ResultSet.java:66) ~[classes/:?]
zero88 commented
Could you provide a simplified example?
Anyway, I think you can provide an SPI for fixing the custom type in your application
Please check #255 (comment)
glassfox commented
Not sure if SPI will help in this situation.
zero88 commented
JsonObject
cannot keep java datetime type, except Instant
. But JsonArray
can.
The safe way is using loop over ResultSet, then you can access exact data per column