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