【发布时间】:2021-09-25 11:42:52
【问题描述】:
我想从我的 Java EE 7 服务器应用程序中删除直接的 Hibernate 引用,以便将来我不会对 hibernate-core 产生编译时依赖。作为替代,我想使用普通的 JPA API。
到目前为止,我发现org.hibernate.annotations.Cascade 和org.hibernate.annotations.CascadeType 大部分可以转移到JPA 的@ManyToOne 或@OneToMany 的级联参数上。
此外,org.hibernate.annotations.Type 似乎可以被合适的 JPA @Converter 替换。
但是,在我的代码中还有更多 Hibernate 的用法,而我却在苦苦挣扎:
org.hibernate.annotations.Immutableorg.hibernate.annotations.OptimisticLockorg.hibernate.annotations.DiscriminatorOptionsorg.hibernate.annotations.Fetchorg.hibernate.EmptyInterceptor
您能否给我一些提示,是否以及如何将它们迁移到 JPA?或者,非常感谢 Hibernate → JPA 迁移指南/教程的链接。
【问题讨论】:
标签: java hibernate jpa jakarta-ee persistence