I have a problem with the serialization of a LocalDateTime of an JPA entity class. I have a class 'Challenge' which contains two dates 'begindate' and 'enddate'.
...
@Column(name = "begindate")
private LocalDateTime begindate;
@Column(name = "enddate")
private LocalDateTime enddate;
...
I already specified a LocalDateTimeAttributeConverter that JPA can convert the LocalDateTime to a Timestamp.
I wrote a web application using Jersey which requests my challenge entities from the database.
When i test a GET request for an entity, I expect that a date is displayed like "begindate": "2019-09-01T00:00:00+02:00", but my application delivers the attribute in this format:
"begindate": {
"date": {
"dayOfWeek": "MONDAY",
"month": "JULY",
"year": 2019,
"dayOfMonth": 1,
"dayOfYear": 182,
"era": "CE",
"monthValue": 7,
"chronology": {
"calendarType": "iso8601",
"id": "ISO"
},
"leapYear": false,
"day": 1
},
"dayOfWeek": "MONDAY",
"hour": 12,
"month": "JULY",
"dayOfMonth": 1,
"dayOfYear": 182,
"year": 2019,
"monthValue": 7,
"nano": 0,
"time": {
"hour": 12,
"nano": 0,
"minute": 0,
"second": 0
},
"minute": 0,
"second": 0
}
When I used a GlassFish Server the output was as I expected it. Now I am using TomEE 7 because I had some troubles with the GlassFish Server and here a LocalDateTime gets serialized in JSON. Is it somehow possible to get the output in the above mentioned simple format?
Thanks for your help!