Our repository entities have audit/log properties like (createdDate
, updatedDate
...) that are assigned by the application and should be read-only properties to the user. A little bit of research on Jackson showed this feature is not supported (or is it?). Wondering if SDR could be of any help here?
@Document(collection="employees")
public class Employee {
@Id
private String id;
private firstName;
private lastName;
//read-only attribute. initially assigned by application and should not be changed
private Date createdDate;
//read-only attribute. initially assigned by application and should not be changed
private Employee createdBy;
//getters setters truncated....
}
org.springframework.data.annotation.ReadOnlyProperty is added in spring-data-commons 1.9.0.
This serves the purpose. Please refer: