title: Using jodatime in a Mongo entity with Spring Data
body: <p>I have an entity that will be persisted with Spring Data to a Mongo Database:</p>
  
  <pre><code>@Document
  public class MyEntity {
  
      @Id
      private String id;
  
      @QueryType(PropertyType.DATETIME)
      private DateTime lastUpdate;
  
  }
  </code></pre>
  
  <p>This is my repository:</p>
  
  <pre><code>public interface MyEntityRepository extends
      MongoRepository&lt;MyEntity, String&gt;,
      QueryDslPredicateExecutor&lt;MyEntity&gt; {}
  </code></pre>
  
  <p>And the plugin in my pom.xml for QueryDSL generation</p>
  
  <pre><code>            &lt;plugin&gt;
              &lt;groupId&gt;com.mysema.maven&lt;/groupId&gt;
              &lt;artifactId&gt;apt-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.0.8&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;phase&gt;generate-sources&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;process&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;outputDirectory&gt;target/generated-sources&lt;/outputDirectory&gt;
                          &lt;processor&gt;org.springframework.data.mongodb.repository.support.MongoAnnotationProcessor&lt;/processor&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>Still, it's treating DateTime as a regular entity (I've tried with and without QueryType). I'd like it to be treated as date, so I can do comparisons, as right now I cannot:</p>
  
  <pre><code>Predicate predicate = QMyEntity.myentity.lastUpdate... // where are the lessThan or greaterThan methods?
  </code></pre>
  
  <p>Of course, if possible, I'd like to stick to JodaTime, instead of falling back to Java Date, or storing the date as millis.</p>