我有这样的存储库:
public interface IDomainRepository extends MongoRepository<Domain, String>{
}
我添加这样的分页支持后:
public interface IDomainRepository extends MongoRepository<Domain, String>{
Page<Domain> getDomains(String projectId, Pageable pageable);
}
我有错误:
Caused by: java.lang.IllegalArgumentException: No property get found for type class org.krams.tutorial.domain.nosql.Domain
at org.springframework.data.repository.query.parser.Property.<init>(Property.java:73)
at org.springframework.data.repository.query.parser.Property.<init> ...
我的pom.xml中的版本是:
<!-- Versions -->
<properties>
<spring.version>3.2.1.RELEASE</spring.version>
<spring.data.jpa.version>1.3.0.RELEASE</spring.data.jpa.version>
<spring.data.mongo.version>1.2.0.BUILD-SNAPSHOT</spring.data.mongo.version>
<spring.amqp.version>1.0.0.RELEASE</spring.amqp.version>
<slf4j-version>1.6.1</slf4j-version>
<org.cloudfoundry-version>0.8.0</org.cloudfoundry-version>
<jackson-mapper>1.9.10</jackson-mapper>
</properties>
有什么问题?
答案 0 :(得分:0)
好的,明白了!
错误的原因是:
如果你想在MongoRepository中使用Pageable,
域对象需要有成员域,因此您可以添加如
public Page<Domain> findByDomains(String domains, Pageable pageable);