1.MyBatis的配置 config.xml
<configuration>
<!-- 驼峰式命名配置 -->
<!-- 为实体类定义别名 -->
<typeAliases>
<!-- <typeAlias type="cn.qst.model.Order" alias="Order"/> -->
<package name="cn.qst.model" />
</typeAliases>
<environments default="development">
<environment id="development">
<transactionManager type="JDBC" />
<dataSource type="POOLED">
<property name="driver" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/mybatis" />
<property name="username" value="root" />
<property name="password" value="123" />
</dataSource>
</environment>
</environments>
<mappers>
<mapper resource="cn/qst/mapper/UserMapper.xml"/>
<mapper resource="cn/qst/mapper/OrderMapper.xml"/>
<mapper resource="cn/qst/mapper/ClassesMapper.xml"/>
</mappers>
</configuration>
<!-- 驼峰式命名配置 -->
<settings>
<setting name="mapUnderscoreToCamelCase" value="true"/>
</settings><!-- 为实体类定义别名 -->
<typeAliases>
<!-- <typeAlias type="cn.qst.model.Order" alias="Order"/> -->
<package name="cn.qst.model" />
</typeAliases>
<environments default="development">
<environment id="development">
<transactionManager type="JDBC" />
<dataSource type="POOLED">
<property name="driver" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/mybatis" />
<property name="username" value="root" />
<property name="password" value="123" />
</dataSource>
</environment>
</environments>
<mappers>
<mapper resource="cn/qst/mapper/UserMapper.xml"/>
<mapper resource="cn/qst/mapper/OrderMapper.xml"/>
<mapper resource="cn/qst/mapper/ClassesMapper.xml"/>
</mappers>
</configuration>