如何正确序列化VersionedEntity?

时间:2016-04-05 23:43:26

标签: spring spring-mvc spring-lemon

我有一个这样的实体:

@Entity
public class Shop extends VersionedEntity<User, Long> {
    @Column
    private String name;
    @Column
    private String url;
    @Column
    private String status;
    private String description;

我现在正在尝试序列化商店列表,然后我得到了这个:

)]}',
[{"id":1,"createdDate":{"year":2016,"dayOfMonth":6,"dayOfWeek":3,"era":1,"dayOfYear":97,"weekOfWeekyear":14,"secondOfMinute":38,"millisOfSecond":0,"centuryOfEra":20,"yearOfEra":2016,"yearOfCentury":16,"weekyear":2016,"monthOfYear":4,"hourOfDay":0,"minuteOfHour":8,"millisOfDay":518000,"secondOfDay":518,"minuteOfDay":8,"millis":1459897718000,"zone":{"fixed":false,"uncachedZone":{"fixed":false,"cachable":true,"id":"Africa/Casablanca"},"id":"Africa/Casablanca"},"chronology":{"zone":{"fixed":false,"uncachedZone":{"fixed":false,"cachable":true,"id":"Africa/Casablanca"},"id":"Africa/Casablanca"}},"afterNow":false,"beforeNow":true,"equalNow":false},"lastModifiedDate":{"year":2016,"dayOfMonth":6,"dayOfWeek":3,"era":1,"dayOfYear":97,"weekOfWeekyear":14,"secondOfMinute":38,"millisOfSecond":0,"centuryOfEra":20,"yearOfEra":2016,"yearOfCentury":16,"weekyear":2016,"monthOfYear":4,"hourOfDay":0,"minuteOfHour":8,"millisOfDay":518000,"secondOfDay":518,"minuteOfDay":8,"millis":1459897718000,"zone":{"fixed":false,"uncachedZone":{"fixed":false,"cachable":true,"id":"Africa/Casablanca"},"id":"Africa/Casablanca"},"chronology":{"zone":{"fixed":false,"uncachedZone":{"fixed":false,"cachable":true,"id":"Africa/Casablanca"},"id":"Africa/Casablanca"}},"afterNow":false,"beforeNow":true,"equalNow":false},"version":0,"name":"Shop Name","url":"shop1","status":"Active","description":"Shop description","new":false},{"id":3,"createdDate":{"year":2016,"dayOfMonth":6,"dayOfWeek":3,"era":1,"dayOfYear":97,"weekOfWeekyear":14,"secondOfMinute":57,"millisOfSecond":0,"centuryOfEra":20,"yearOfEra":2016,"yearOfCentury":16,"weekyear":2016,"monthOfYear":4,"hourOfDay":0,"minuteOfHour":9,"millisOfDay":597000,"secondOfDay":597,"minuteOfDay":9,"millis":1459897797000,"zone":{"fixed":false,"uncachedZone":{"fixed":false,"cachable":true,"id":"Africa/Casablanca"},"id":"Africa/Casablanca"},"chronology":{"zone":{"fixed":false,"uncachedZone":{"fixed":false,"cachable":true,"id":"Africa/Casablanca"},"id":"Africa/Casablanca"}},"afterNow":false,"beforeNow":true,"equalNow":false},"lastModifiedDate":{"year":2016,"dayOfMonth":6,"dayOfWeek":3,"era":1,"dayOfYear":97,"weekOfWeekyear":14,"secondOfMinute":57,"millisOfSecond":0,"centuryOfEra":20,"yearOfEra":2016,"yearOfCentury":16,"weekyear":2016,"monthOfYear":4,"hourOfDay":0,"minuteOfHour":9,"millisOfDay":597000,"secondOfDay":597,"minuteOfDay":9,"millis":1459897797000,"zone":{"fixed":false,"uncachedZone":{"fixed":false,"cachable":true,"id":"Africa/Casablanca"},"id":"Africa/Casablanca"},"chronology":{"zone":{"fixed":false,"uncachedZone":{"fixed":false,"cachable":true,"id":"Africa/Casablanca"},"id":"Africa/Casablanca"}},"afterNow":false,"beforeNow":true,"equalNow":false},"version":0,"name":"shop3","url":"shop3","status":"ACTIVE","description":"Shop description, from ShopService","new":false}]

我理解那些令人不安的漫长日期来自createdDatelastModifiedDate我从VersionedEntity继承而来。

如何避免在此输出中获取它们?

1 个答案:

答案 0 :(得分:0)

使用

注释sudo apt-get install -y sqlite3 libsqlite3-dev 课程
Shop
我认为

应该有用。