日期:2014-05-18 浏览次数:20709 次
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="transactionInterceptor"
class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager" ref="transactionManager"></property>
<property name="transactionAttributes">
<props>
<prop key="add*">PROPAGATION_SUPPORTS</prop>
<prop key="query">PROPAGATION_SUPPORTS,readOnly</prop>
</props>
</property>
</bean>
<bean
class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="beanNames">
<value>*ServiceImp</value>
</property>
<property name="interceptorNames">
<list>
<value>transactionInterceptor</value>
</list>
</property>
</bean>
public interface FileListService {
public void add(ZipFileDto dto);
}
public class FileListServiceImp implements FileListService {
public FileListDao fileListDao;
public void setFileListDao(FileListDao fileListDao) {
this.fileListDao = fileListDao;
}
public void add(ZipFileDto dto) {
fileListDao.add(dto);
}
}