如何将Hibernate 5安装到Apache Karaf v4中

时间:2015-12-13 21:32:34

标签: java hibernate karaf

我安装了Apache Karaf v4.03并查询了Hibernate的可用功能列表,如下所示。不幸的是,我正在使用Hibernate v5。

hibernate                     | 3.3.2.GA         |          | Uninstalled | enterprise-4.0.3         | Hibernate 3.x JPA persistence engine support
hibernate                     | 4.2.15.Final     |          | Uninstalled | enterprise-4.0.3         | Hibernate 4.2.x JPA persistence engine support
hibernate-envers              | 4.2.15.Final     |          | Uninstalled | enterprise-4.0.3         | Hibernate Envers 4.2.x
hibernate                     | 4.3.6.Final      |          | Uninstalled | enterprise-4.0.3         | Hibernate 4.3.x JPA persistence engine support
hibernate-envers              | 4.3.6.Final      |          | Uninstalled | enterprise-4.0.3         | Hibernate Envers 4.3.x
hibernate-validator           | 5.0.3.Final      |          | Uninstalled | enterprise-4.0.3         | Hibernate Validator support

我无法找到将Hibernate v5安装到Karaf v4的说明。是否有已发布的执行此任务的说明,以及可下载的功能文件?

3 个答案:

答案 0 :(得分:4)

最新的hibernate版本已经准备好了Karaf:

如果从hibernate的页面(http://sourceforge.net/projects/hibernate/files/hibernate-orm/5.0.5.Final/hibernate-release-5.0.5.Final.zip/download)下载hibernate-release-5.0.5.Final.zip并解压缩该文件,您将看到osgi文件夹。 在那里你可以找到一个已经准备好的功能:hibernate-osgi-5.0.5.Final-karaf.xml。 您只需将其复制到Karaf的部署文件夹,然后执行:

feature:install hibernate-orm

应该没有任何问题安装。

安装hibernate 5.0.5功能的另一种方法是使用以下命令为功能添加repo:

feature:repo-add command.

在这里您可以看到hibernate功能列表以及我安装的功能:

karaf@root()> feature:list | grep hibernate
hibernate                     | 3.3.2.GA         |          | Uninstalled | enterprise-4.0.3         | Hibernate 3.x JPA persistence engine support
hibernate                     | 4.2.15.Final     |          | Uninstalled | enterprise-4.0.3         | Hibernate 4.2.x JPA persistence engine support
hibernate-envers              | 4.2.15.Final     |          | Uninstalled | enterprise-4.0.3         | Hibernate Envers 4.2.x
hibernate                     | 4.3.6.Final      |          | Uninstalled | enterprise-4.0.3         | Hibernate 4.3.x JPA persistence engine support
hibernate-envers              | 4.3.6.Final      |          | Uninstalled | enterprise-4.0.3         | Hibernate Envers 4.3.x
hibernate-validator           | 5.0.3.Final      |          | Uninstalled | enterprise-4.0.3         | Hibernate Validator support
hibernate-orm                 | 5.0.5.Final      | x        | Started     | hibernate-osgi           | Combines all Hibernate core dependencies and requ
hibernate-envers              | 5.0.5.Final      |          | Uninstalled | hibernate-osgi           | Feature for easily adding Envers support to hiber
hibernate-infinispan          | 5.0.5.Final      |          | Uninstalled | hibernate-osgi           | Feature for easily adding Infinispan-based cachin
hibernate-ehcache             | 5.0.5.Final      |          | Uninstalled | hibernate-osgi           | Feature for easily adding Ehcache-based caching s
karaf@root()>

答案 1 :(得分:1)

在Karaf shell上运行以下命令以使Hibernate 5.1.0.Final在Karaf 4.0.x上运行:

feature:repo-add mvn:org.hibernate/hibernate-osgi/5.1.0.Final/xml/karaf
feature:install hibernate-orm

答案 2 :(得分:0)

Hibernate 5已经提供了一个也可以从maven central获得的功能。最近的karaf版本提供了安装此类功能的一个很好的快捷方式:

feature:repo-add hibernate 5.0.5.Final
feature:install hibernate-orm

因此无需手动下载hibernate zip。 如果你构建自己的需要hibernate 5的功能,那么你需要在其中提供一个指向完整的hibernate功能url的元素。

mvn:org.hibernate/hibernate-osgi/5.0.5.Final/xml/karaf