1

I am new to Spring Roo and this question is regarding the JSON de-serialization of Calender Java Datatype. I am using the reverse engineering feature of Spring ROO where I generate the model entities from my DB schema.

The TIMESTAMP columns in the DB schema are converted to Calender datatypes in the auto generated Roo managed entities. Now while I try to receive the result as JSON, the flexjson de-serializer is breaking while trying to deserialize the Calender datatype.

Can anyone here pleas help me resolve this issue as this is currently a blocker for my development.

Thanks in advance.

user1242321
  • 1,578
  • 2
  • 18
  • 30
  • The following question seems to somewhat take care of it, but this does not apply for the auto generated antities using Roo reverse engineering. http://stackoverflow.com/questions/5549905/spring-roo-date-field-with-current-timestamp – user1242321 Oct 04 '13 at 18:14
  • here is a jira bug which fixes the code to convert timestamp column as Calendar: https://jira.springsource.org/browse/ROO-3243 – user1242321 Oct 04 '13 at 18:23

1 Answers1

2

By default, even with the latest Spring Roo (1.3.1 RC2) the version of flexjson that is used is 2.1. Support for Calendar was added in later versions (3.0), change the maven dependency to 3.2 (the latest)

 <dependency>
        <groupId>net.sf.flexjson</groupId>
        <artifactId>flexjson</artifactId>
        <version>3.2</version>
        <!-- roo was defaulting to 2.1 -->
    </dependency>

flexjson ref - http://flexjson.sourceforge.net/changelog.html

chrismarx
  • 11,488
  • 9
  • 84
  • 97
  • the other problem i found, was that while they did add the DefaultCalendarTransformer, which successfully serializes calendar objects to json, afaik, there is no CalendarObjectFactory to deserialize javascript date fields back to Calendar. I wrote my own, I can post if you need it – chrismarx Mar 03 '15 at 14:47