Two Laptop Bag*
The moose likes Object Relational Mapping and the fly likes LocalSessionFactoryBean with spring - hibernate integration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "LocalSessionFactoryBean with spring - hibernate integration" Watch "LocalSessionFactoryBean with spring - hibernate integration" New topic
Author

LocalSessionFactoryBean with spring - hibernate integration

Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 627
Hi All,

I am using Hibernate 4 and Spring 3.2. I am unable to find a jar which would find me org.springframework.orm.hibernate4.LocalSessionFactoryBean. Does anyone know if that class is supported with spring 3 and hibernate 4? If not, is there an alternative to it? Please advice

Thanks


Be Humble... Be Nice.
Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 627
Anybody guys?

Thanks
Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 627
Ok..I found the class in spring-orm.jar. But have another question now. Looks like the below property is deprecated in hibernate 4's LocalSessionFactoryBean class



Currently I have my disopatcher servlet-xml as below and I am getting the error:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/MyServlet-servlet.xml]: Invocation of init method failed; nested exception is java.lang.AbstractMethodError: com.sybase.jdbc2.jdbc.SybDatabaseMetaData.supportsGetGeneratedKeys()Z





Any thoughts?
Rajesh So
Ranch Hand

Joined: Oct 08, 2002
Posts: 134
Hi Arjun,

I am not sure if this helps. But I noticed that you can still use your older configuration. migration guide

List of migration concerns as users migrate from 3.5 to 3.6

AnnotationConfigration merged into Configuration : for most users this is nothing to be conerned with (aside from the fact that AnnotationConfiguration is now deprecated). However, for users still using hbm.xml you should be aware that we chose to use the org.hibernate.cfg.EJB3NamingStrategy used in AnnotationConfigration instead of the older org.hibernate.cfg.DefaultNamingStrategy historically used on Configuration. This may cause naming mismatches; one known place where this is an issue is if you rely on the naming strategy to default the name of a association (many-to-many and collections of elements) table. If you find yourself in this situation, you can tell Hibernate to use the the legacy org.hibernate.cfg.DefaultNamingStrategy by calling Configuration#setNamingStrategy and passing it org.hibernate.cfg.DefaultNamingStrategy#INSTANCE
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: LocalSessionFactoryBean with spring - hibernate integration
 
Similar Threads
Spring: delimiter after & in spring config
Unable to lookup JNDI name - hibernate 4.1.5 , Spring 3.1.1 , JBoss 5
hibernate3 & spring 1.2.4
Hibernate Spring Integration problem
Invocation of init method failed; exception is org.hibernate.InvalidMappingException