1. AnnotationSessionFactoryBean is used to create session factory if hibernate pojo are annotated
  2. AnnotationSessionFactoryBean is a factory that produces SessionFactory automatically.This is used when you create a sessionFactory object of Hibernate from Spring
     <bean id="sessionFactory" class="org.springframework.orm.hibernate3.
    annotation.AnnotationSessionFactoryBean">
       <property name="dataSource" ref="dataSource"/>
       <property name="annotatedClasses">
         <list>
           <value>test.package.Foo</value>
           <value>test.package.Bar</value>
         </list>
       </property>
     </bean>
    
  3. This session factory is assigned to all dao beans and hibernate template to do database transaction.
    <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.
    HibernateTemplate">
    	<property name="sessionFactory">
    	  <ref bean="sessionFactory" />
    	</property>
    </bean>
    <bean id="pageDao" class="com.concretepage.dao.PageDaoImpl">
        <property name="hibernateTemplate">
    	  <ref bean="hibernateTemplate" />
    	</property>
    </bean>
    

Comments are closed.