Can I erase GSON Time mark? ex) AM/PM - spring

I use GSON to change the object to json. Also, set and use the code below. As a result, the desired timestamp was obtained.
#Bean
public Gson gson() {
return new GsonBuilder()
.setExclusionStrategies(new AnnotationBasedExclusionStrategy())
.setDateFormat("yyyy-MM-dd HH:mm:ss")
.create();
}
However, there is a mark like AM and PM behind the time.
I hope 13:00:00 to 13:00:00 Not 1:00:00 PM
What should I do to get the results I want? Can existing timestamp results be kept together?
ToString Method shows desired result...
#Entity
#Table(name="tb_work_system")
public class WorkSystem {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
#Column(nullable=false)
private String work_system_type;
#Column(nullable=false)
private Time work_start_time;
#Column(nullable=false)
private Time work_end_time;
#Column(nullable=false)
private Time rest_start_time;
#Column(nullable=false)
private Time rest_end_time;
#Column(nullable=false,columnDefinition="BOOLEAN DEFAULT false")
private Boolean deleted=false;
#CreationTimestamp
private Timestamp created_at;
#UpdateTimestamp
private Timestamp updated_at;
}
//ToString Method
WorkSystem [id=1, work_system_type=탄력 근무제, work_start_time=09:00:00, work_end_time=18:00:00, rest_start_time=12:00:00, rest_end_time=13:00:00, deleted=false, created_at=2020-01-31 12:18:13.595343, updated_at=2020-01-31 12:18:13.595343]
//ToJson(Gson)
{"id":1,"work_system_type":"탄력 근무제","work_start_time":"09:00:00 오전","work_end_time":"06:00:00 오후","rest_start_time":"12:00:00 오후","rest_end_time":"01:00:00 오후","deleted":false,"created_at":"2020-01-31 12:18:13","updated_at":"2020-01-31 12:18:13"}

Related

#dbref cannot create a reference to an object with a null id

I'm working with spring boot and mongodb while trying to persist data with relation (OneToMany) I get this error:
org.springframework.data.mapping.MappingException: Cannot create a reference to an object with a NULL id.
My Enteties:
public class ReleveBancaireEntity implements Serializable {
#Id
private ObjectId id;
#CreatedDate
#DateTimeFormat(iso = ISO.DATE_TIME)
private Date dateReception;
#DBRef
private List<LigneReleveEntity> lignereleve = new ArrayList<>();
}
public class LigneReleveEntity {
#Id
private ObjectId id;
#CreatedDate
#DateTimeFormat(iso = ISO.DATE_TIME)
private Date dateOperation;
#CreatedDate
#DateTimeFormat(iso = ISO.DATE_TIME)
private Date dateValue;
private ObjectId releveBancaireId;
}
Saving data to MongoDB:
public void addReleveBancaire(ReleveBancaireDTO releveBancaire) {
ReleveBancaireEntity releveBancaireEntity = mapper.map(releveBancaire,ReleveBancaireEntity.class);
List<LigneReleveEntity> ligneReleveEntities = ObjectMapperUtils.mapAll(releveBancaire.getLignereleve(),LigneReleveEntity
.class);
ligneReleveEntities.forEach(ligneReleveEntity ->
ligneReleveEntity.setReleveBancaireId(releveBancaireEntity.getId()));
releveBancaireEntity.setLignereleve(ligneReleveEntities);
releveBancaireRepository.save(releveBancaireEntity);
ligneReleveRepository.saveAll(ligneReleveEntities);
}

Is there a possibility to reference another class via value object

How can I make a many-to-one xml mapping from the stayId of RoomOccupancy to the stayId of Stay. Note that StayId is a value object, therefore it does not contain the whole reference to Stay.
public class RoomOccupancy {
// generated hibernate id
private Long id;
private LocalDate startDate;
private LocalDate endDate;
private StayId stayId;
}
public class Stay {
// generated hibernate id
private Long id;
private StayId stayId;
}
I would be very glad, if someone could help me out.Thank you in Advance!
If I understood you, then you need make it like this:
public class RoomOccupancy {
private Long id;
private LocalDate startDate;
private LocalDate endDate;
#ManyToOne(fetch = FetchType.EAGER, targetEntity = Stay .class)
#JoinColumn(name = "stayId")
private Stay stay;
}
public class Stay {
private Long id;
}
Or if you need as xml, just add next code to your xml file
<many-to-one name = "stay" column = "stayId" class="Stay " not-null="true"/>

Ignore field for query in spring-r2dbc

I am using spring r2dbc and ReactiveCrudRepository in spring webflex applicaition.
I have a field which I need to ignore for when select query is generated
( in Controller code is r2dbcEntityTemplate.select(Tenant.class) ).
I try to using #Transient ,But It doesn't work, still error: "Required property daysRemaining not found for class Tenant"
With my limited experience with r2dbc, Thanks in advance.
#Accessors(chain = true)
#Table(value = "tenant")
#Data
#Builder
public class Tenant {
#Id
private Long id;
#Column(value = "organization_name")
private String organizationName;
#Version
#Column
private Long version;
#Column
private Boolean trialTenant;
#DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
#JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
#Column
private LocalDateTime tenantExpiredTime;
#Transient
//Dynamically calculate the remaining time
private Long daysRemaining;
public Long getDaysRemaining() {
return Optional.ofNullable(tenantExpiredTime)
.map(localDateTime -> Duration.between(localDateTime, LocalDateTime.now()))
.map(Duration::toDays)
.orElseGet(() -> null);
}
}
#ReadOnlyProperty annotation works.

Date with time stamp is not storing

This is the Date value that client is sending
createdOn : "2017-09-14T13:23:44"
In Controller client value is mapping to the Dto, AttachmentsDto
public class AttachmentsDto implements Serializable {
#JsonFormat(pattern="yyyy-MM-dd'T'HH:mm:ss", timezone="Asia/Muscat")
private Date createdOn;
}
Below is the Attachment Entity
public class Attachments implements Serializable {
private static final long serialVersionUID = 1L;
#Temporal(TemporalType.TIMESTAMP)
#Column(name="CREATED_ON", insertable= true, updatable=false)
private Date createdOn;
}
Service have written code to save the entire dto.
mapped dto to entity and called repo save here.
attachmentsRepo.save(mapper.map(AttachmentsDto, Attachments.class)), AttachmentsDto.class);
Here its saving only date there is no timestamp.
Db createdOn = 9/14/2017
How can I store date and timestamp ?

Spring 4 ZoneDateTime Restful recursive output

I am new on Java 8 and Spring 4
i have tried to implement spring boot with module (Spring boot web, Spring boot jpa)
i have tried to implement JpaAuditing on my entity with the following code:
//AbstractAuditedEntity.class
#MappedSuperclass
public class AbstractAuditedEntity {
#CreatedBy
#Column(name = "CREATED_BY")
private String createdBy;
// #Type(type="org.joda.time.contrib.hibernate.PersistentDateTime")
#CreatedDate
#DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
#Column(name = "CREATED_DATE")
// #Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
private ZonedDateTime createdDate;
#LastModifiedBy
#Column(name = "LAST_MODIFIED_BY")
private String lastModifiedBy;
// #Type(type="org.joda.time.contrib.hibernate.PersistentDateTime")
#DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
#LastModifiedDate
#Column(name = "LAST_MODIFIED_DATE")
// #Type(type = "org.jadira.usertype.dateandtime.joda.PersistentLocalDateTime")
private ZonedDateTime lastModifiedDate;
/*setter getter are omitted*/
}
and the User entity with the following code :
#Entity
#Table(name = "common_user")
public class User extends AbstractAuditedEntity {
#Id
#GeneratedValue(strategy = GenerationType.AUTO)
#Column(name = "ID")
private Long id;
/*other fields are omitted*/
}
and my controller :
#RestController
public class UserCtrl {
#Autowired
UserRepository userRepository;
#RequestMapping(value = "/user", method = RequestMethod.GET)
#ResponseBody
public User index() {
User one = userRepository.findOne(1L);
return one;
}
}
the result is of field createdDate and lastModifiedDate are recursive :(
{"createdBy":"SYSTEM","createdDate":{"offset":{"totalSeconds":25200,"rules": {"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+07:00"},"zone":{"id":"Asia/Jakarta","rules":{"fixedOffset":false,"transitionRules":[],"transitions":[{"offsetBefore":{"totalSeconds":25632,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+07:07:12"},"offsetAfter":{"totalSeconds":26400,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+07:20"},"dateTimeAfter":{"hour":0,"minute":0,"nano":0,"second":0,"month":"JANUARY","year":1924,"dayOfMonth":1,"dayOfWeek":"TUESDAY","dayOfYear":1,"monthValue":1,"chronology":{"calendarType":"iso8601","id":"ISO"}},"duration":{"seconds":768,"zero":false,"negative":false,"nano":0,"units":["SECONDS","NANOS"]},"gap":true,"overlap":false,"dateTimeBefore":{"hour":23,"minute":47,"nano":0,"second":12,"month":"DECEMBER","year":1923,"dayOfMonth":31,"dayOfWeek":"MONDAY","dayOfYear":365,"monthValue":12,"chronology":{"calendarType":"iso8601","id":"ISO"}},"instant":{"epochSecond":-1451719200,"nano":0}},{"offsetBefore":{"totalSeconds":26400,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+07:20"},"offsetAfter":{"totalSeconds":27000,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+07:30"},"dateTimeAfter":{"hour":0,"minute":10,"nano":0,"second":0,"month":"NOVEMBER","year":1932,"dayOfMonth":1,"dayOfWeek":"TUESDAY","dayOfYear":306,"monthValue":11,"chronology":{"calendarType":"iso8601","id":"ISO"}},"duration":{"seconds":600,"zero":false,"negative":false,"nano":0,"units":["SECONDS","NANOS"]},"gap":true,"overlap":false,"dateTimeBefore":{"hour":0,"minute":0,"nano":0,"second":0,"month":"NOVEMBER","year":1932,"dayOfMonth":1,"dayOfWeek":"TUESDAY","dayOfYear":306,"monthValue":11,"chronology":{"calendarType":"iso8601","id":"ISO"}},"instant":{"epochSecond":-1172906400,"nano":0}},{"offsetBefore":{"totalSeconds":27000,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+07:30"},"offsetAfter":{"totalSeconds":32400,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+09:00"},"dateTimeAfter":{"hour":1,"minute":30,"nano":0,"second":0,"month":"MARCH","year":1942,"dayOfMonth":23,"dayOfWeek":"MONDAY","dayOfYear":82,"monthValue":3,"chronology":{"calendarType":"iso8601","id":"ISO"}},"duration":{"seconds":5400,"zero":false,"negative":false,"nano":0,"units":["SECONDS","NANOS"]},"gap":true,"overlap":false,"dateTimeBefore":{"hour":0,"minute":0,"nano":0,"second":0,"month":"MARCH","year":1942,"dayOfMonth":23,"dayOfWeek":"MONDAY","dayOfYear":82,"monthValue":3,"chronology":{"calendarType":"iso8601","id":"ISO"}},"instant":{"epochSecond":-876641400,"nano":0}},{"offsetBefore":{"totalSeconds":32400,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+09:00"},"offsetAfter":{"totalSeconds":27000,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+07:30"},"dateTimeAfter":{"hour":22,"minute":30,"nano":0,"second":0,"month":"SEPTEMBER","year":1945,"dayOfMonth":22,"dayOfWeek":"SATURDAY","dayOfYear":265,"monthValue":9,"chronology":{"calendarType":"iso8601","id":"ISO"}},"duration":{"seconds":-5400,"zero":false,"negative":true,"nano":0,"units":["SECONDS","NANOS"]},"gap":false,"overlap":true,"dateTimeBefore":{"hour":0,"minute":0,"nano":0,"second":0,"month":"SEPTEMBER","year":1945,"dayOfMonth":23,"dayOfWeek":"SUNDAY","dayOfYear":266,"monthValue":9,"chronology":{"calendarType":"iso8601","id":"ISO"}},"instant":{"epochSecond":-766054800,"nano":0}},{"offsetBefore":{"totalSeconds":27000,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+07:30"},"offsetAfter":{"totalSeconds":28800,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+08:00"},"dateTimeAfter":{"hour":0,"minute":30,"nano":0,"second":0,"month":"MAY","year":1948,"dayOfMonth":1,"dayOfWeek":"SATURDAY","dayOfYear":122,"monthValue":5,"chronology":{"calendarType":"iso8601","id":"ISO"}},"duration":{"seconds":1800,"zero":false,"negative":false,"nano":0,"units":["SECONDS","NANOS"]},"gap":true,"overlap":false,"dateTimeBefore":{"hour":0,"minute":0,"nano":0,"second":0,"month":"MAY","year":1948,"dayOfMonth":1,"dayOfWeek":"SATURDAY","dayOfYear":122,"monthValue":5,"chronology":{"calendarType":"iso8601","id":"ISO"}},"instant":{"epochSecond":-683883000,"nano":0}},{"offsetBefore":{"totalSeconds":28800,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+08:00"},"offsetAfter":{"totalSeconds":27000,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+07:30"},"dateTimeAfter":{"hour":23,"minute":30,"nano":0,"second":0,"month":"APRIL","year":1950,"dayOfMonth":30,"dayOfWeek":"SUNDAY","dayOfYear":120,"monthValue":4,"chronology":{"calendarType":"iso8601","id":"ISO"}},"duration":{"seconds":-1800,"zero":false,"negative":true,"nano":0,"units":["SECONDS","NANOS"]},"gap":false,"overlap":true,"dateTimeBefore":{"hour":0,"minute":0,"nano":0,"second":0,"month":"MAY","year":1950,"dayOfMonth":1,"dayOfWeek":"MONDAY","dayOfYear":121,"monthValue":5,"chronology":{"calendarType":"iso8601","id":"ISO"}},"instant":{"epochSecond":-620812800,"nano":0}},{"offsetBefore":{"totalSeconds":27000,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+07:30"},"offsetAfter":{"totalSeconds":25200,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+07:00"},"dateTimeAfter":{"hour":23,"minute":30,"nano":0,"second":0,"month":"DECEMBER","year":1963,"dayOfMonth":31,"dayOfWeek":"TUESDAY","dayOfYear":365,"monthValue":12,"chronology":{"calendarType":"iso8601","id":"ISO"}},"duration":{"seconds":-1800,"zero":false,"negative":true,"nano":0,"units":["SECONDS","NANOS"]},"gap":false,"overlap":true,"dateTimeBefore":{"hour":0,"minute":0,"nano":0,"second":0,"month":"JANUARY","year":1964,"dayOfMonth":1,"dayOfWeek":"WEDNESDAY","dayOfYear":1,"monthValue":1,"chronology":{"calendarType":"iso8601","id":"ISO"}},"instant":{"epochSecond":-189415800,"nano":0}}]}},"hour":15,"minute":37,"nano":576000000,"second":41,"month":"AUGUST","year":2014,"dayOfMonth":21,"dayOfWeek":"THURSDAY","dayOfYear":233,"monthValue":8,"chronology":{"calendarType":"iso8601","id":"ISO"}},"lastModifiedBy":"SYSTEM","lastModifiedDate":{"offset":{"totalSeconds":25200,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+07:00"},"zone":{"id":"Asia/Jakarta","rules":{"fixedOffset":false,"transitionRules":[],"transitions":[{"offsetBefore":{"totalSeconds":25632,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+07:07:12"},"offsetAfter":{"totalSeconds":26400,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+07:20"},"dateTimeAfter":{"hour":0,"minute":0,"nano":0,"second":0,"month":"JANUARY","year":1924,"dayOfMonth":1,"dayOfWeek":"TUESDAY","dayOfYear":1,"monthValue":1,"chronology":{"calendarType":"iso8601","id":"ISO"}},"duration":{"seconds":768,"zero":false,"negative":false,"nano":0,"units":["SECONDS","NANOS"]},"gap":true,"overlap":false,"dateTimeBefore":{"hour":23,"minute":47,"nano":0,"second":12,"month":"DECEMBER","year":1923,"dayOfMonth":31,"dayOfWeek":"MONDAY","dayOfYear":365,"monthValue":12,"chronology":{"calendarType":"iso8601","id":"ISO"}},"instant":{"epochSecond":-1451719200,"nano":0}},{"offsetBefore":{"totalSeconds":26400,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+07:20"},"offsetAfter":{"totalSeconds":27000,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+07:30"},"dateTimeAfter":{"hour":0,"minute":10,"nano":0,"second":0,"month":"NOVEMBER","year":1932,"dayOfMonth":1,"dayOfWeek":"TUESDAY","dayOfYear":306,"monthValue":11,"chronology":{"calendarType":"iso8601","id":"ISO"}},"duration":{"seconds":600,"zero":false,"negative":false,"nano":0,"units":["SECONDS","NANOS"]},"gap":true,"overlap":false,"dateTimeBefore":{"hour":0,"minute":0,"nano":0,"second":0,"month":"NOVEMBER","year":1932,"dayOfMonth":1,"dayOfWeek":"TUESDAY","dayOfYear":306,"monthValue":11,"chronology":{"calendarType":"iso8601","id":"ISO"}},"instant":{"epochSecond":-1172906400,"nano":0}},{"offsetBefore":{"totalSeconds":27000,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+07:30"},"offsetAfter":{"totalSeconds":32400,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+09:00"},"dateTimeAfter":{"hour":1,"minute":30,"nano":0,"second":0,"month":"MARCH","year":1942,"dayOfMonth":23,"dayOfWeek":"MONDAY","dayOfYear":82,"monthValue":3,"chronology":{"calendarType":"iso8601","id":"ISO"}},"duration":{"seconds":5400,"zero":false,"negative":false,"nano":0,"units":["SECONDS","NANOS"]},"gap":true,"overlap":false,"dateTimeBefore":{"hour":0,"minute":0,"nano":0,"second":0,"month":"MARCH","year":1942,"dayOfMonth":23,"dayOfWeek":"MONDAY","dayOfYear":82,"monthValue":3,"chronology":{"calendarType":"iso8601","id":"ISO"}},"instant":{"epochSecond":-876641400,"nano":0}},{"offsetBefore":{"totalSeconds":32400,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+09:00"},"offsetAfter":{"totalSeconds":27000,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+07:30"},"dateTimeAfter":{"hour":22,"minute":30,"nano":0,"second":0,"month":"SEPTEMBER","year":1945,"dayOfMonth":22,"dayOfWeek":"SATURDAY","dayOfYear":265,"monthValue":9,"chronology":{"calendarType":"iso8601","id":"ISO"}},"duration":{"seconds":-5400,"zero":false,"negative":true,"nano":0,"units":["SECONDS","NANOS"]},"gap":false,"overlap":true,"dateTimeBefore":{"hour":0,"minute":0,"nano":0,"second":0,"month":"SEPTEMBER","year":1945,"dayOfMonth":23,"dayOfWeek":"SUNDAY","dayOfYear":266,"monthValue":9,"chronology":{"calendarType":"iso8601","id":"ISO"}},"instant":{"epochSecond":-766054800,"nano":0}},{"offsetBefore":{"totalSeconds":27000,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+07:30"},"offsetAfter":{"totalSeconds":28800,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+08:00"},"dateTimeAfter":{"hour":0,"minute":30,"nano":0,"second":0,"month":"MAY","year":1948,"dayOfMonth":1,"dayOfWeek":"SATURDAY","dayOfYear":122,"monthValue":5,"chronology":{"calendarType":"iso8601","id":"ISO"}},"duration":{"seconds":1800,"zero":false,"negative":false,"nano":0,"units":["SECONDS","NANOS"]},"gap":true,"overlap":false,"dateTimeBefore":{"hour":0,"minute":0,"nano":0,"second":0,"month":"MAY","year":1948,"dayOfMonth":1,"dayOfWeek":"SATURDAY","dayOfYear":122,"monthValue":5,"chronology":{"calendarType":"iso8601","id":"ISO"}},"instant":{"epochSecond":-683883000,"nano":0}},{"offsetBefore":{"totalSeconds":28800,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+08:00"},"offsetAfter":{"totalSeconds":27000,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+07:30"},"dateTimeAfter":{"hour":23,"minute":30,"nano":0,"second":0,"month":"APRIL","year":1950,"dayOfMonth":30,"dayOfWeek":"SUNDAY","dayOfYear":120,"monthValue":4,"chronology":{"calendarType":"iso8601","id":"ISO"}},"duration":{"seconds":-1800,"zero":false,"negative":true,"nano":0,"units":["SECONDS","NANOS"]},"gap":false,"overlap":true,"dateTimeBefore":{"hour":0,"minute":0,"nano":0,"second":0,"month":"MAY","year":1950,"dayOfMonth":1,"dayOfWeek":"MONDAY","dayOfYear":121,"monthValue":5,"chronology":{"calendarType":"iso8601","id":"ISO"}},"instant":{"epochSecond":-620812800,"nano":0}},{"offsetBefore":{"totalSeconds":27000,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+07:30"},"offsetAfter":{"totalSeconds":25200,"rules":{"fixedOffset":true,"transitionRules":[],"transitions":[]},"id":"+07:00"},"dateTimeAfter":{"hour":23,"minute":30,"nano":0,"second":0,"month":"DECEMBER","year":1963,"dayOfMonth":31,"dayOfWeek":"TUESDAY","dayOfYear":365,"monthValue":12,"chronology":{"calendarType":"iso8601","id":"ISO"}},"duration":{"seconds":-1800,"zero":false,"negative":true,"nano":0,"units":["SECONDS","NANOS"]},"gap":false,"overlap":true,"dateTimeBefore":{"hour":0,"minute":0,"nano":0,"second":0,"month":"JANUARY","year":1964,"dayOfMonth":1,"dayOfWeek":"WEDNESDAY","dayOfYear":1,"monthValue":1,"chronology":{"calendarType":"iso8601","id":"ISO"}},"instant":{"epochSecond":-189415800,"nano":0}}]}},"hour":15,"minute":37,"nano":576000000,"second":41,"month":"AUGUST","year":2014,"dayOfMonth":21,"dayOfWeek":"THURSDAY","dayOfYear":233,"monthValue":8,"chronology":{"calendarType":"iso8601","id":"ISO"}},"id":1,"firstName":"adil","lastName":"ramdan","username":"admin","password":null,"email":"adil.ramdan#gmail.com","photo":"pp.jpg","group":null,"shaPassword":null,"authToken":null}
How to format ZoneDateTime in the Restful ?thanks before
That's not actually recursive; you can see for yourself by posting that json string into http://jsonformatter.curiousconcept.com/.
If you want to use ZonedDateTime and you don't want all of its properties converted to JSON, you might add #JsonIgnore to the field and then adding getters for each field that you want. For example:
#JsonIgnore
#CreatedDate
#DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
#Column(name = "CREATED_DATE")
private ZonedDateTime createdDate;
public Month getMonthCreated(){
return createdDate.getMonth();
}

Resources