JSF+Spring+Hibernate的实例讲解(原创翻译)(16) </bean>
<!-- Transactional proxy for the Catalog Service --><bean id="catalogService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="catalogServiceTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="save*">PROPAGATION_REQUIRED</prop> <prop key="update*">PROPAGATION_REQUIRED</prop> <prop key="delete*">PROPAGATION_REQUIRED</prop> </props> </property></bean>Spring声明事务管理是在CatalogService. CatalogService 里面设置,它能实现不同CatalogDao。Spring创建并管理单体实例Catalogservice,不需要工厂。现在,业务逻辑层准备好了,让我们将它与集成层整合。Integration between Spring and Hibernate:下面是HibernateSessionFactory的配置:
<!-- Hibernate SessionFactory Definition --><bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean"> <property name="mappingResources"> <list> <value>catalog/model/businessobject/ProdUCt.hbm.XML</value> <value>catalog/model/businessobject/Category.hbm.XML</value>