开发者

SessionFactory in Hibernate

开发者 https://www.devze.com 2022-12-24 13:36 出处:网络
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 \"n

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.SessionF开发者_如何学Cactory" are same?

Can I replace first with second one?

Thanks, Komal


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?


Use org.hibernate.SessionFactory.

http://docs.jboss.org/hibernate/stable/core/api/org/hibernate/SessionFactory.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号