timyates / mod-jdbc-persistor

BusMod Persistor for JDBC support in vert.x
Other
36 stars 14 forks source link

Timestamp error #26

Open rsasai opened 9 years ago

rsasai commented 9 years ago

Hi

It was all good with the combination of:

I have updated vert.x:

Then I am getting this error: [com.bloidonia~mod-jdbc-persistor~2.1.2-com.bloidonia.vertx.mods.JdbcProcessor-1715900756] Caught error with SELECT org.vertx.java.core.VertxException: Cannot have objects of class class java.sql.Timestamp in JSON at org.vertx.java.core.json.JsonElement.convertMap(JsonElement.java:60) at org.vertx.java.core.json.JsonObject.(JsonObject.java:56) at org.vertx.java.core.json.JsonObject.(JsonObject.java:45) at com.bloidonia.vertx.mods.JsonUtils.listOfMapsToJsonArray(JsonUtils.java:61) at com.bloidonia.vertx.mods.JdbcProcessor$4.process(JdbcProcessor.java:277) ...

To be honest this is frustrating because the only thing I did was upgrading vert.x. Would it be possible for your persister to handle this so clients don't have to change their code, please?

Thank you. Uppsax

timyates commented 9 years ago

Handle what?

Handle Vert.x changing what objects are natively allowed to be serialised over the event bus?

I'll have a look to see if there's an easy solution to this, but can't think of one off the top of my head at the moment

As a workaround, you could change your SQL so it returns a strong representation of a timestamp rather than a timestamp itself On 30 May 2015 10:20, "Ryu Sasai" notifications@github.com wrote:

Hi

It was all good with the combination of:

  • vert.x 2.0.2-final
  • jdbc-persister 2.1.2

I have updated vert.x:

  • vert.x 2.1.5
  • jdbc-persister 2.1.2

Then I am getting this error: [com.bloidonia~mod-jdbc-persistor~2.1.2-com.bloidonia.vertx.mods.JdbcProcessor-1715900756] Caught error with SELECT org.vertx.java.core.VertxException: Cannot have objects of class class java.sql.Timestamp in JSON at org.vertx.java.core.json.JsonElement.convertMap(JsonElement.java:60) at org.vertx.java.core.json.JsonObject.(JsonObject.java:56) at org.vertx.java.core.json.JsonObject.(JsonObject.java:45) at com.bloidonia.vertx.mods.JsonUtils.listOfMapsToJsonArray(JsonUtils.java:61) at com.bloidonia.vertx.mods.JdbcProcessor$4.process(JdbcProcessor.java:277) ...

To be honest this is frustrating because the only thing I did was upgrading vert.x. Would it be possible for your persister to handle this so clients don't have to change their code, please?

Thank you. Uppsax

— Reply to this email directly or view it on GitHub https://github.com/timyates/mod-jdbc-persistor/issues/26.

rsasai commented 9 years ago

Thank you for your quick reply. It's good that there's a workaround. However, it seems that quite a few people have written a lot of sql already and are having the timestamp issue just because they have upgraded vert.x. Now that vert.x has already moved on, which is a bit of a hindrance for the persister client, it would be a great piece of news for persister users if you could absorb the issue within the persister. Thank you. Uppsax

timyates commented 9 years ago

Not sure I can though.

I can change it to a string in the persister, but people would need to know this, and parse it back out of a string on the client

With v3, this can probably be done with the new proxy methods, but these don't exist in v2 On 30 May 2015 11:19, "Ryu Sasai" notifications@github.com wrote:

Thank you for your quick reply. It's good that there's a workaround. However, it seems that quite a few people have written a lot of sql already and are having the timestamp issue just because they have upgraded vert.x. Now that vert.x has already moved on, which is a bit of a hindrance for the persister client, it would be a great piece of news for persister users if you could absorb the issue within the persister. Thank you. Uppsax

— Reply to this email directly or view it on GitHub https://github.com/timyates/mod-jdbc-persistor/issues/26#issuecomment-107018996 .