开放自由和休眠 [英] Open liberty and Hibernate
问题描述
我可以在开放自由中使用Hibernate作为JPA实现吗?如果存在这样的集成,我想它会带有分布式缓存和JTA吗?
Can I use Hibernate as JPA implementation in open-liberty? If such integration exists, I would presume that it comes with distributed caching and JTA?
推荐答案
是的,在OpenLiberty中,我们具有jpaContainer-2.1
功能,该功能仅提供 JPA容器集成代码,并允许用户插入他们自己的符合JPA 2.1的实现(即EclipseLink或Hibernate).
Yes, in OpenLiberty we have the jpaContainer-2.1
feature, which provides only the JPA container integration code, and allows the user to plug in their own JPA 2.1 compliant implementation (i.e. EclipseLink or Hibernate).
专门用于Hibernate,jpaContainer-2.1
功能将把Hibernate与Liberty的事务管理器集成在一起.参见
Specifically for Hibernate, the jpaContainer-2.1
feature will integrate Hibernate with Liberty's transaction manager. See LibertyJtaPlatform
您可以在此处找到完整的文档,包括配置示例:
部署JPA申请自由
You can find full documentation here, including config examples:
Deploying a JPA application to Liberty
在server.xml中需要的基本配置如下:
The basic config you will need in server.xml is the following:
<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>
这篇关于开放自由和休眠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!