Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

LocalSessionFactoryBean with spring - hibernate integration

 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anybody guys?

Thanks
 
Arjun Reddy
Ranch Hand
Posts: 629
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic