D:\WS\Dervice\src\com\lining\vmservice\mapper>java -jar mybatis-generator-co re-1.3.0.jar -configfile generatorConfig.xml Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String ind ex out of range: -1 at java.lang.String.substring(String.java:1875) at org.mybatis.generator.api.dom.java.FullyQualifiedJavaType.simpleParse (FullyQualifiedJavaType.java:374) at org.mybatis.generator.api.dom.java.FullyQualifiedJavaType.parse(Fully QualifiedJavaType.java:362) at org.mybatis.generator.api.dom.java.FullyQualifiedJavaType.<init>(Full yQualifiedJavaType.java:68) at org.mybatis.generator.codegen.mybatis3.model.BaseRecordGenerator.getC ompilationUnits(BaseRecordGenerator.java:54) at org.mybatis.generator.codegen.mybatis3.IntrospectedTableMyBatis3Impl. getGeneratedJavaFiles(IntrospectedTableMyBatis3Impl.java:137) at org.mybatis.generator.config.Context.generateFiles(Context.java:468) at org.mybatis.generator.api.MyBatisGenerator.generate(MyBatisGenerator. java:234) at org.mybatis.generator.api.ShellRunner.main(ShellRunner.java:116)
<?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" > <generatorConfiguration > <classPathEntry location="D:\WS\lining\WebContent\WEB-INF\lib\postgresql-9.3-1101.jdbc3.jar" /> <context id="context1" > <commentGenerator> <property name="suppressDate" value="true" /> </commentGenerator> <jdbcConnection driverClass="org.postgresql.Driver" connectionURL="jdbc:postgresql://localhost:23482/MyDB" userId="mydb" password="password"> </jdbcConnection> <javaModelGenerator targetPackage="com.lining.vmservice.model" targetProject="lining"> <property name="enableSubPackages" value="true" /> <property name="trimStrings" value="true" /> </javaModelGenerator> <sqlMapGenerator targetPackage="com.lining.vmservice.mapper" targetProject="lining"> <property name="enableSubPackages" value="true" /> </sqlMapGenerator> <javaClientGenerator targetPackage="com.lining.vmservice.mapper" targetProject="lining" type="XMLMAPPER"> <property name="enableSubPackages" value="true" /> </javaClientGenerator> <table tableName="islands" domainObjectName="islands" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"> </table> </context> </generatorConfiguration>
表如下:
CREATE TABLE islands
(
id serial NOT NULL,
rt_progress character varying(2),
rt_speed character varying(1),
rt_progress_molecule bigint,
rt_progress_denominator bigint,
rt_suspend_cause character varying(1),
CONSTRAINT islands_pkey PRIMARY KEY (id)
)
解决方案