我的配置:
[code="java"]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<!-- 连接数据库的JAR包 -->
<!-- 去掉生成出来的代码的注解 -->
<commentGenerator>
<property name="suppressAllComments" value="true" />
<property name="suppressDate" value="true" />
</commentGenerator>
<!-- 连接 -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/test"
userId="root"
password="******">
</jdbcConnection>
<javaTypeResolver >
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<!-- 生成model\xml\dao -->
<javaModelGenerator targetPackage="test.model" targetProject="src">
<property name="enableSubPackages" value="true" />
<property name="trimStrings" value="true" />
</javaModelGenerator>
<sqlMapGenerator targetPackage="test.xml" targetProject="src">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>
<javaClientGenerator type="XMLMAPPER" targetPackage="test.dao" targetProject="src">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>
<!-- 要生成的相关数据表,如果有多个表的话,需要配置多个 -->
<table tableName="user">
<property name="ignoreQualifiersAtRuntime" value="true" />
<property name="runtimeTableName" value="user" />
</table>
[/code]
关于DAO层的配置具体是这些代码:
[code="java"]
</javaClientGenerator
[/code]
可是这样遇到一个问题,就是只生成了UserMapper.java
具体内容如下,部分省略:
[code="java"]
public interface UserMapper {
int countByExample(UserExample example);
}
[/code]
比较好奇的是,只生成了接口类,却没有生成具体实现类,是不是我配置有问题?