我可以在开放自由中使用Hibernate作为JPA实现吗?如果存在这样的集成,我会假设它带有分布式缓存和JTA?
答案 0 :(得分:4)
是的,在OpenLiberty中我们有jpaContainer-2.1
功能,它只提供 JPA容器集成代码,并允许用户插入他们自己的JPA 2.1兼容实现(即EclipseLink或休眠)。
特别是对于Hibernate,jpaContainer-2.1
功能将Hibernate与Liberty的事务管理器集成在一起。见LibertyJtaPlatform
您可以在此处找到完整的文档,包括配置示例:
Deploying a JPA application to 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>