我正在尝试将 Glassfish Hibernate 提供程序从当前的 3.5.0 版本更新到 3.6.6.Final。
我需要社区的帮助(以及 Glassfish 开发人员的帮助)。我通过电子邮件网关向 Glassfish 论坛提交了这个问题,但论坛系统再次关闭。如果它回来,您可以在这里找到(等效)问题:http://www.java.net/forum/topic/glassfish/glassfish/updating-support-hibernate-glassfish-need-communitys-help。我还将其提交到 Hibernate 论坛:https://forum。 hibernate.org/viewtopic.php?f=1&t=1010771。
背景:如果您搜索有关将 Hibernate 与 Glassfish 集成的信息,您将收到数十篇文章,它们都建议执行以下操作之一:
- 将 Hibernate 及其依赖项直接放入
domain1/lib
中。
- 将 Hibernate 与您的应用程序打包在一起。
- 从 Glassfish 更新中心 安装 Hibernate。
当前显示的每个选项都有问题,从错误到类加载器问题,或者,对于更新中心来说,版本过时(更新中心安装的 Hibernate 版本 Hibernate 3.5.0.Final 违反了 JPA 2.0 JPQL语法,因此与 JPA 2.0 不兼容)。这篇善意的文章可以最好地概括这种状态: http:// eskatos.wordpress.com/2007/10/09/hello-world/ 文章本身不再起作用,并且对文章的更新也不起作用。
Sahoo 建议了另一种我非常喜欢的方法: http ://www.java.net/forum/topic/glassfish/glassfish/using-hibernate-glassfish#comment-814634
这会将 Hibernate 依赖项放置在其自己的文件夹中domain1/applibs
,由空 hibernate.jar
引用,其 MANIFEST.MF
中带有 Class-Path:
。这太棒了。它是独立的、易于升级、与 IPS 打包机制兼容,并且应用程序必须在部署时使用 --libraries
选项指定它们希望 Hibernate 可见。
那么,那么。 依赖项目录中有什么? 我不担心传递依赖项,只担心 Hibernate 编写的依赖项。
在当前的 Hibernate 更新中心包中,依赖性很小。您可以通过下载 http://maven.glassfish.org/index.html#view-repositories;Java.net.2~browsestorage~/org/glassfish-repo/packager/hibernate-ips/3.5.0-Final -1/hibernate-ips-3.5.0-Final-1.zip 每当http://maven.glassfish.org 并不忙于抛出 503 错误的常规业务功能。
它们很小的原因是安装的 Hibernate 工件是 hibernate3.jar,它似乎是 Hibernate 的一个将所有东西都扔进拳击碗的发行版,因此已被此后在所有发行版中都被无情地踩掉了。这位朋友有一个很好的总结:http://www.javaworld.com/community/node/7686< /a>
在 Hibernate 版本 3.6.6 中,值得庆幸的是,这个工件不再生成或上传到 Maven。相反,您应该选择自己的依赖项。
对于个人开发人员来说这很好,但是当您谈论在应用程序服务器级别提供支持时,该怎么办?包括所有可选的依赖项?其中一些?哪些?这就是我需要你帮助的地方。
从查看 hibernate-all
程序集描述符,您可以看到 Hibernate 的优秀人员已经用此配方替换了 hibernate3.jar
。您可以进一步看到该描述符生成的工件将包含其中的每个 hibernate-*
模块。
如果我打算对现有的 Hibernate 更新中心包进行简单升级,我可能会尽我所能将其包含在内,因为它大致相当于旧的 hibernate3.jar
。但我想我应该先在这里问,因为 hibernate3.jar
是一种令人厌恶的东西:应该有哪些依赖项 - 并且有许多可选的依赖项,缓存提供程序等Hibernate 更新中心支持“发货”吗?
作为一种比较,您可以看到 JBoss AS7 附带的数量非常非常小:https://github.com/jbossas/jboss-as/blob/master /pom.xml#L2696 例如,它们似乎不包括 EHCache、SwarmCache 或 OSCache 提供程序。
所以,再说一遍,除了 hibernate-core 和 hibernate-entitymanager(显然它们必须存在才能使 Hibernate 正常工作)之外,Hibernate 更新中心还应该依赖哪些其他依赖项套餐包括?
I'm trying to update the Glassfish Hibernate provider from its current 3.5.0 version to 3.6.6.Final.
I need the community's help (and that of the Glassfish developers). I submitted this question via the email gateway to the Glassfish forums, but the forum system is down again. In the event it ever comes back, you can find the (equivalent) question here: http://www.java.net/forum/topic/glassfish/glassfish/updating-support-hibernate-glassfish-need-communitys-help. I've also submitted it to the Hibernate forums: https://forum.hibernate.org/viewtopic.php?f=1&t=1010771.
The background: if you search on integrating Hibernate with Glassfish, you will get dozens and dozens of articles that all recommend doing one of these things:
- Put Hibernate and its dependencies straight in
domain1/lib
.
- Package Hibernate with your application.
- Install Hibernate from the Glassfish Update Center.
Each option as currently manifested has problems, ranging from bugs to classloader problems, or, in the case of the Update Center, version staleness (Hibernate 3.5.0.Final, the version of Hibernate installed by the Update Center, violates the JPA 2.0 JPQL syntax and hence is not JPA 2.0 compatible). The state can be best summed up with this well-intentioned article: http://eskatos.wordpress.com/2007/10/09/hello-world/ The article itself no longer works, and the update to the article doesn't work either.
Sahoo suggested another approach that I like very much: http://www.java.net/forum/topic/glassfish/glassfish/using-hibernate-glassfish#comment-814634
This would place the Hibernate dependencies in their own folder under domain1/applibs
, referenced by an empty hibernate.jar
with a Class-Path:
in its MANIFEST.MF
. This is great. It's isolated, simple to upgrade, compatible with the IPS packaging mechanism, and applications have to specify on deployment with the --libraries
option that they want Hibernate to be visible.
So, then. What goes in that dependencies directory? I am not worried about the transitive dependencies, just the Hibernate-authored ones.
In the current Hibernate Update Center package, the dependencies are minimal. You can see what they are by downloading http://maven.glassfish.org/index.html#view-repositories;Java.net.2~browsestorage~/org/glassfish-repo/packager/hibernate-ips/3.5.0-Final-1/hibernate-ips-3.5.0-Final-1.zip whenever http://maven.glassfish.org is not busy with its usual business function of throwing 503 errors.
The reason they're minimal is that the Hibernate artifact that is installed is hibernate3.jar
, which seems to be a throw-everything-into-the-punch-bowl distribution of Hibernate, and hence has been stomped mercilessly out of existence in every distribution since. This fellow has a nice summary: http://www.javaworld.com/community/node/7686
In Hibernate version 3.6.6, thankfully, this artifact is no longer produced or uploaded to Maven. Instead, it is expected that you will choose your own dependencies.
That's fine for an individual developer, but when you're talking about providing support at the application server level, what to do? Include all the optional dependencies? Some of them? Which ones? And that's where I need your help.
From looking at the hibernate-all
assembly descriptor, you can see that the fine folks at Hibernate have replaced hibernate3.jar
with this recipe. You can further see that the artifact produced by this descriptor is going to have every single hibernate-*
module in it.
If I were shooting for a simple upgrade of the existing Hibernate Update Center package, I would probably do what I could to include this, since it's roughly equivalent to the old hibernate3.jar
. But I thought I'd ask here first, since the hibernate3.jar
is kind of an abomination: What dependencies--and there are many optional ones, cache providers and the like--should Hibernate Update Center support "ship" with?
As a kind of comparison, you can see that JBoss AS7 ships with a tiny, tiny amount: https://github.com/jbossas/jboss-as/blob/master/pom.xml#L2696 They do not seem to include the EHCache, SwarmCache or OSCache providers, for example.
So, again, besides hibernate-core
and hibernate-entitymanager
(which obviously have to exist in order to have Hibernate work at all), what other dependencies should the Hibernate Update Center package include?
发布评论