luminus-framework/examples

h2 timestamp parsing error

temco opened this issue · 2 comments

temco commented

I follow the http://www.luminusweb.net/docs/guestbook.html and everything is OK, until I copy the code under the sub-title "Adding some tests" into the test/clj/guestbook/test/db/core.clj and run the "lein test".

Caused by: org.h2.jdbc.JdbcBatchUpdateException: Cannot parse "TIMESTAMP" constant "aced0005737200166f72672e6a6f64612e74696d652e4461746554696d65b83c78646a5bddf90200007872001f6f72672e6a6f64612e74696d652e626173652e426173654461746554696d65fffff9e14f5d2ea30200024a0007694d696c6c69734c000b694368726f6e6f6c6f677974001a4c6f72672f6a6f64612f74696d652f4368726f6e6f6c6f67793b787000000167d9c5e6f5737200276f72672e6a6f64612e74696d652e6368726f6e6f2e49534f4368726f6e6f6c6f67792453747562a9c811667137502703000078707372001f6f72672e6a6f64612e74696d652e4461746554696d655a6f6e652453747562a62f019a7c321ae30300007870770500035554437878"; SQL statement:
INSERT INTO guestbook
(name, message, timestamp)

It seems that the timestamp object got by the code-line "(let [timestamp (org.joda.time.DateTime. org.joda.time.DateTimeZone/UTC)]" cannot be parsed by h2?

Ah thanks for the heads up. I switched Luminus to use native Java 9 time instead of Joda and missed the doc for that. Just pushed out an update for the example, and the docs.

temco commented

Ah thanks for the heads up. I switched Luminus to use native Java 9 time instead of Joda and missed the doc for that. Just pushed out an update for the example, and the docs.

Thanks, I've replaced "(org.joda.time.DateTime. org.joda.time.DateTimeZone/UTC)" with "(java.time.LocalDateTime/now)" and it works.