首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

将hibernate的配备移植到spring中

2012-09-10 
将hibernate的配置移植到spring中?xml version1.0 encodingUTF-8?beans xmlnshttp://www.sprin

将hibernate的配置移植到spring中

<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:util="http://www.springframework.org/schema/util"xmlns:p="http://www.springframework.org/schema/p"xmlns:aop="http://www.springframework.org/schema/aop"xmlns:tx="http://www.springframework.org/schema/tx"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsdhttp://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsdhttp://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsdhttp://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"> <bean id="propertyConfigurer"  /><property name="url"value="${jdbc.url}" /><property name="username" value="${jdbc.username}" /><property name="password" value="${jdbc.password}" /><property name="initialSize" value="5" /><property name="maxActive" value="100" /><property name="maxIdle" value="30" /><property name="maxWait" value="1000" /><property name="poolPreparedStatements" value="true" /><property name="defaultAutoCommit" value="false" /></bean><bean id="sessionFactory"ref="dataSource"></property><property name="mappingResources"><list><value>com/yuanhai/pojo/Admin.hbm.xml</value><value>com/yuanhai/pojo/Contactway.hbm.xml</value><value>com/yuanhai/pojo/Freephne.hbm.xml</value><value>com/yuanhai/pojo/HelpInfo.hbm.xml</value><value>com/yuanhai/pojo/IndexClass.hbm.xml</value><value>com/yuanhai/pojo/Pictures.hbm.xml</value><value>com/yuanhai/pojo/Scheme.hbm.xml</value><value>com/yuanhai/pojo/Subclass.hbm.xml</value><value>com/yuanhai/pojo/SubclassInfo.hbm.xml</value><value>com/yuanhai/pojo/SuclssInfoContent.hbm.xml</value></list></property><property name="hibernateProperties"><props><prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop><prop key="hibernate.show_sql">true</prop><prop key="hibernate.format_sql">true</prop></props></property></bean><!-- 数据库访问的基类 --><bean id="baseDao" ref="sessionFactory"></property></bean><!-- 事务相关配置 --><bean id="transactionManager"ref="sessionFactory"></property></bean><tx:advice id="adv" transaction-manager="transactionManager"><tx:attributes><tx:method name="add*" propagation="REQUIRED" /><tx:method name="remove*" propagation="REQUIRED" /><tx:method name="modif*" propagation="REQUIRED" /><tx:method name="*" propagation="SUPPORTS" read-only="true" /></tx:attributes></tx:advice><aop:config><aop:advisor advice-ref="adv"pointcut="execution(public * com.yuanhai.biz.*.*(..))" /></aop:config><!-- 其它资源文件引入--><import resource="config/spring/system.xml" /></beans>


网上全面文章
http://blog.csdn.net/ayan117/archive/2010/07/20/5748134.aspx

热点排行