【问题标题】:Spring's couchbase JPA repository with abstract class fails to find entitySpring的带有抽象类的couchbase JPA存储库找不到实体
【发布时间】:2019-11-27 10:13:27
【问题描述】:

我们正在使用 Couchbase 在 Springboot 中开发一个项目,我有以下类:

public abstract class Content {
    ...    
}

public class Film extends Content {
    ...
}
public class Serie extends Content {
    ...
}

然后我有以下 JPA 存储库:

public interface ContentJpaRepository extends ReactiveCouchbaseSortingRepository<Content> {
}

然后,当我保存内容(电影或系列)时,内容已成功保存,但是,_class 字段获取简单的类名(而不是完整的包名)。 然后,在做的时候:

repository.findById(id);

存储库失败,因为它无法将 json 文档反序列化为预期的实体。我怎样才能做到这一点?

非常感谢

【问题讨论】:

    标签: spring spring-data-jpa couchbase spring-data-couchbase


    【解决方案1】:

    Couchbase Spring Data 目前不支持使用通用存储库,因为 _class 属性将引用抽象类而不是其实现。

    【讨论】:

      猜你喜欢
      • 2019-04-26
      • 2020-03-18
      • 2012-04-12
      • 2012-07-16
      • 2020-09-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-19
      相关资源
      最近更新 更多