我可以在开放自由中使用 Hibernate 作为 JPA 实现吗?如果存在这样的集成,我会假设它带有分布式缓存和 JTA?
问问题
1839 次
1 回答
7
是的,在 OpenLiberty 中我们有一个jpaContainer-2.1
特性,它只提供 JPA 容器集成代码,并允许用户插入他们自己的 JPA 2.1 兼容实现(即 EclipseLink 或 Hibernate)。
特别是对于 Hibernate,该jpaContainer-2.1
功能将把 Hibernate 与 Liberty 的事务管理器集成在一起。请参阅LibertyJtaPlatform
您可以在此处找到完整的文档,包括配置示例:
将 JPA 应用程序部署到 Liberty
server.xml 中需要的基本配置如下:
<featureManager>
<feature>jpaContainer-2.1</feature>
<feature>bells-1.0</feature>
...
</featureManager>
<!-- Making a 'bell' for the library will register any META-INF/services in the referenced library with the Liberty runtime -->
<bell libraryRef="hibernate"/>
<!-- Include all of the hibernate jars in a shared lib -->
<library id="hibernate">
<fileset dir="${server.config.dir}/hibernate/" includes="*.jar"/>
</library>
<!-- OPTIONAL: If you wish to directly reference hibernate APIs in your app, you will need to configure a shared library classloader -->
<application location="myApp.war">
<classloader commonLibraryRef="hibernate"/>
</application>
于 2017-11-20T16:21:01.783 回答