Hibernate 中的 SessionFactory

发布于 2024-08-26 20:22:48 字数 375 浏览 5 评论 0原文

我在我的 spring 项目中使用 hibernate-2.1 和“net.sf.hibernate.SessionFactory”类。

现在我切换到 Spring 2.5.6.A,他们使用 hibernate3,但我无法找到其中的“net.sf.hibernate”包。

但我在包“org.springframework.orm.toplink”中找到了SessionFactory类。

hibernate-2.1“net.sf.hibernate.SessionFactory”中的类和“org.springframework.orm.toplink.SessionFactory”中的另一个类是否相同?

我可以用第二个替换第一个吗?

谢谢, 科马尔

I am using hibernate-2.1 and "net.sf.hibernate.SessionFactory" class in my spring project.

Now I am switched to Spring 2.5.6.A, where they are using hibernate3 and I am not able to find out the "net.sf.hibernate" package in that.

But I found SessionFactory class in the package "org.springframework.orm.toplink".

Is both the class one in hibernate-2.1 "net.sf.hibernate.SessionFactory" and another in "org.springframework.orm.toplink.SessionFactory" are same?

Can I replace first with second one?

Thanks,
Komal

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

a√萤火虫的光℡ 2024-09-02 20:22:48

Spring 不久前删除了对 Hibernate 2 的支持。在 Spring 2.0 中,Hibernate 2 支持是一个可选扩展,Spring 2.5 及更高版本仅支持 Hibernate 3。

当 Hibernate 从 v2 到 v3 时,包命名从 net.sf.hibernate 更改为 org.hibernate

Spring 的 TopLink SessionFactory 与 Hibernate 没有任何关系,所以不要使用它。

最后,如果您只是切换到 Spring 2.5.6,那么您应该考虑直接升级到 3.0 - 为什么要升级到已经过时的版本?

Support for Hibernate 2 was removed from Spring some time ago. With Spring 2.0, Hibernate 2 support was an optional extension, and Spring 2.5 and above supports only Hibernate 3.

When Hibernate went from v2 to v3, the package naming changed from net.sf.hibernate to org.hibernate.

Spring's TopLink SessionFactory has nothing whatsoever to do with Hibernate, so don't use that.

Lastly, if you are just switching to Spring 2.5.6, then you should consider going direct to 3.0 instead - why upgrade to an already obsoleted version?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文