views:

242

answers:

2

Hi,

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

+1  A: 

Use org.hibernate.SessionFactory.

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

Chandru
+4  A: 

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?

skaffman