提交 ccb869f6 编写于 作者: shuzheng5201314's avatar shuzheng5201314

mybatis配置提到common中

上级 395d2c22
......@@ -6,7 +6,7 @@
<cache type="org.mybatis.caches.ehcache.LoggingEhcache" />
<!-- 结果映射关系 -->
<resultMap id="UserResultMap" type="userVO">
<resultMap id="UserResultMap" type="com.zheng.cms.dao.model.UserVO">
<id column="u_id" property="id"/>
<result column="username" property="username"/>
<result column="password" property="password"/>
......@@ -14,7 +14,7 @@
<result column="sex" property="sex"/>
<result column="ctime" property="ctime"/>
<result column="content" property="content" />
<collection column="userid" property="books" ofType="Book">
<collection column="userid" property="books" ofType="com.zheng.cms.dao.model.Book">
<id column="b_id" property="id"/>
<result column="userid" property="userid"/>
<result column="name" property="name"/>
......
package com.zheng.cms.dao.model;
import java.awt.print.Book;
import java.util.List;
/**
......
......@@ -34,7 +34,7 @@
<property name="timeBetweenEvictionRunsMillis" value="60000" />
<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
<property name="minEvictableIdleTimeMillis" value="300000" />
<!-- -->
<!-- 校验语句 -->
<property name="validationQuery" value="SELECT 1" />
<property name="testWhileIdle" value="true" />
<property name="testOnBorrow" value="false" />
......@@ -47,11 +47,11 @@
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="classpath:mybatis-config.xml" />
<property name="mapperLocations" value="classpath:com/zheng/cms/dao/mapper/*Mapper.xml" />
<property name="mapperLocations" value="classpath*:**/mapper/*Mapper.xml" />
</bean>
<!-- Mapper接口所在包名,Spring会自动查找其下的Mapper -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.zheng.cms.dao.mapper" />
<property name="basePackage" value="**.mapper" />
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
</bean>
......
......@@ -10,8 +10,10 @@
</settings>
<!-- 该包下的model不用写包名,会使用 model的首字母小写的非限定类名来作为它的别名,若有注解@Alias("xxx"),则别名为注解值 -->
<!--
<typeAliases>
<package name="com.zheng.cms.dao.model" />
</typeAliases>
-->
</configuration>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册