Results 1 to 2 of 2

Thread: How SessionFactory is wired in

Hybrid View

  1. #1

    Default How SessionFactory is wired in

    I am trying to understand how SessionFactory object is being wired in a Spring/Hibernate application.
    Consider the example from book Spring Live (also available on: http://www.sourcebeat.com/downloads/...-completed.zip)
    According to applicationContext.xml:

    <bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSess ionFactoryBean">
    <property name="dataSource"><ref local="dataSource"/></property>
    .
    .
    .
    </bean>

    <bean id="userDAO" class="org.appfuse.dao.hibernate.UserDAOHibernate" >
    <property name="sessionFactory"><ref local="sessionFactory"/></property>
    </bean>

    class UserDAOHibernate must have method setSessionFactory(...) which it does not, however I have looked in
    HibernateDaoSupport which UserDAOHibernate extends and found the method but it has different signature -
    the parameter is of different type: SessionFactory instead of LocalSessionFactoryBean.
    I am lost at this point.
    Please shed some light on it.

    Thank you.

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    FactoryBean that creates a local Hibernate SessionFactory instance
    (javadoc quote).

    Read the javadoc of LocalSessionFactoryBean - the class implements some interfaces which provide hooks for the factory initialization, thus at the wiring time it will return the needed SessionFactory.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

Similar Threads

  1. Replies: 4
    Last Post: Apr 2nd, 2008, 03:22 PM
  2. Context initialization failed
    By kanonmicke in forum Container
    Replies: 7
    Last Post: Sep 29th, 2005, 12:35 AM
  3. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  4. error creating bean 'sessionfactory'
    By Cuball in forum Data
    Replies: 1
    Last Post: May 11th, 2005, 02:53 AM
  5. Replies: 1
    Last Post: Dec 17th, 2004, 06:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •