我將與春天的數據會保存到Mongo的數據庫實體:與蒙戈實體使用jodatime春數據
@Document
public class MyEntity {
@Id
private String id;
@QueryType(PropertyType.DATETIME)
private DateTime lastUpdate;
}
這是我的倉庫:
public interface MyEntityRepository extends
MongoRepository<MyEntity, String>,
QueryDslPredicateExecutor<MyEntity> {}
和插件在我的pom.xml的QueryDSL代
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.0.8</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources</outputDirectory>
<processor>org.springframework.data.mongodb.repository.support.MongoAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
</plugin>
不過,這是治療的DateTime作爲一個普通的實體(我試着沒有QueryType)。我想它被視爲日期,所以我可以做比較,因爲現在我不能:
Predicate predicate = QMyEntity.myentity.lastUpdate... // where are the lessThan or greaterThan methods?
當然,如果可能的話,我想堅持,而不是回落到至JodaTime, Java日期,或將日期存儲爲毫秒。
我創建了一個問題https://jira.springsource.org/browse/DATAMONGO-624 – Luciano 2013-03-15 12:47:21
已修復Querydsl https: //github.com/mysema/querydsl/issues/364 – 2013-03-16 18:49:36