I have read http://static.springsource.org/spring-data/data-mongo/docs/1.1.0.RELEASE/reference/html/#mapping-chapter but cannot find the answer to the following basic spring-data-mongodb object mapping question:
If I load an instance of the following class from MongoDB:
public class Test {
private String str1;
private String str2;
private Date date3;
public Test(String str1) {
this.str1 = str1;
this.date3=new Date();
}
}
I understand that the constructor Test(String str1) will be invoked with the value found in the top-level field str1 of the MongoDB document.
I assume this constructor is equivalent to declaring a @PersistenceConstructor explicitly.
But what happens to the fields str2, date3 in this case? Will all fields that are not part of the constructor still be initialized, or will the str2, date3 values be lost since a PeristenceConstructor using only str1 was found?
And lastly, in what order will this happen? Will date3 be set by the constructor, then be overwritten by the previously persisted field, or vice versa?