Loads object from the data source
<bean id="someRepository">
    <property name="sessionFactory" ref="sessionFactory"/>
</bean>
Instructs the container to look for beans with @Transactional and decorate them
<tx:annotation-driven transaction-manager="transactionManager"/>
A Hibernate SessionFactory for mapping entities from object to relation tables
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
   <property name="dataSource" ref="dataSource"/>
   <property name="annotatedClasses">
      <list>
         <value>package.Entity1</value>
         <value>package.Entity2</value>
      </list>
   </property>
   <property name="hibernateProperties">
      <value>
         hibernate.format_sql=true
         hibernate.show_sql=true
      </value>
   </property>
</bean>
A transaction manager for working with Hibernate SessionFactories
<bean id="transactionManager"  
    class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
</bean>
Transparent Exception Handling
Annotate classes with @Repository
Define a Spring-provided BeanPostProcessor (eg. <context:annotation-config/> or context:component-scan)
Ref:
https://spring.io/blog/2012/04/06/migrating-to-spring-3-1-and-hibernate-4-1
http://sethuramanmurali.wordpress.com/2013/09/15/difference-between-and-annotation-config-and-component-scan/
Ref:
https://spring.io/blog/2012/04/06/migrating-to-spring-3-1-and-hibernate-4-1
http://sethuramanmurali.wordpress.com/2013/09/15/difference-between-and-annotation-config-and-component-scan/
No comments:
Post a Comment