Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-9365

Doc: Spring 3.x and Hibernate 4 are not compatible. Unable to use HibernateTemplate.

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: None
    • Fix Version/s: 3.1.4, 3.2.1
    • Component/s: None
    • Labels:
      None
    • Last commented by a User:
      false

      Description

      While using Spring HibernateTemplate with the combination of Spring 3.1 and Hibernate 4, we are getting the following exception.

      java.lang.ClassCastException: org.springframework.orm.hibernate4.SessionHolder cannot be cast to org.springframework.orm.hibernate3.SessionHolder
      	at org.springframework.orm.hibernate3.SessionFactoryUtils.doGetSession(SessionFactoryUtils.java:287)
      	at org.springframework.orm.hibernate3.SessionFactoryUtils.getSession(SessionFactoryUtils.java:233)
      	at org.springframework.orm.hibernate3.HibernateTemplate.getSession(HibernateTemplate.java:457)
      	at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:393)
      	at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
      	at org.springframework.orm.hibernate3.HibernateTemplate.loadAll(HibernateTemplate.java:584)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                juergen.hoeller Juergen Hoeller
                Reporter:
                augustinejuly Augustine Parthinathan
                Last updater:
                Juergen Hoeller
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  5 years, 19 weeks, 1 day ago