【发布时间】:2018-09-15 03:15:36
【问题描述】:
我的问题是,spring data couchbase 不会搜索搜索到的类的子类。例如:
型号:
@Document
class A {
@Id
String id
}
@Document
class B extends A {}
和存储库:
public interface ARepository extends PagingAndSortingRepository<A, String>{
Page<A> findAll(Pageable pageable);
}
Spring data couchbase 生成查询,条件为 where
_class="com.example.model.A"
但我也想在这个查询中搜索 B 文档。是某种方式,我该怎么做?当我编写自己的查询时,我必须在查询中定义顺序、限制和偏移量,并且不使用 Pageable。但我想使用 Pageable。
【问题讨论】:
-
嗨,托马斯。您是否找到了使用 Spring Data Couchbase 执行此操作的方法?
-
我的回答有帮助吗? stackoverflow.com/questions/42636774/…
标签: java spring inheritance couchbase spring-data-couchbase