IS_AUTOINCREMENT and IS_GENERATEDCOLUMN Not Supported by Older JDBC Drivers #136

Closed
dai19470 opened this Issue Aug 20, 2016 · 3 comments

Projects

None yet

2 participants

@dai19470

1.when i user tool to generator entity,dao,then throw a exception:
G:\java\mybatis>java -jar mybatis-generator-core-1.3.4.jar -configfile generator
Config.xml -overwrite
java.sql.SQLException: 列名无效
at oracle.jdbc.driver.OracleStatement.getColumnIndex(OracleStatement.jav
a:3677)
at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl
.java:2749)
at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:494
)
at org.mybatis.generator.internal.db.DatabaseIntrospector.getColumns(Dat
abaseIntrospector.java:618)
at org.mybatis.generator.internal.db.DatabaseIntrospector.introspectTabl
es(DatabaseIntrospector.java:221)
at org.mybatis.generator.config.Context.introspectTables(Context.java:65
3)
at org.mybatis.generator.api.MyBatisGenerator.generate(MyBatisGenerator.
java:257)
at org.mybatis.generator.api.MyBatisGenerator.generate(MyBatisGenerator.
java:189)
at org.mybatis.generator.api.ShellRunner.main(ShellRunner.java:117)
2.the config file is:




        <property name="suppressAllComments" value="false"/>
    </commentGenerator>

    <jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver" connectionURL="jdbc:oracle:thin:@192.168.70.95:1521:orcl1" userId="platform" password="platform">
    </jdbcConnection>
    <javaTypeResolver>
        <property name="forceBigDecimals" value="false"/>
    </javaTypeResolver>

    <javaModelGenerator targetPackage="com.joyintech.debt.dto" targetProject="src">
        <property name="enableSubPackages" value="true"/>
        <property name="trimStrings" value="true"/>
    </javaModelGenerator>

    <sqlMapGenerator targetPackage="com.joyintech.debt.map" targetProject="src">
        <property name="enableSubPackages" value="true"/>
    </sqlMapGenerator>

    <javaClientGenerator type="XMLMAPPER" targetPackage="com.joyintech.debt.mapper" targetProject="src">
        <property name="enableSubPackages" value="true"/>
    </javaClientGenerator>

    <table tableName="intd_project_approval" domainObjectName="IntdProjectApproval">

    </table>     
</context>
@jeffgbutler
Member

Can you post the SQL CREATE TABLE statement for intd_project_approval? This error seems to be related to delimited column names so I'd like to see how the columns are defined.

@dai19470
dai19470 commented Aug 20, 2016 edited

i also have a table named intd_project_approval,this is table :
create table INTD_PROJECT_APPROVAL
(
id VARCHAR2(32) not null,
project_no VARCHAR2(50),
project_name VARCHAR2(100),
parent_id VARCHAR2(36),
issue_num VARCHAR2(36),
agency VARCHAR2(36),
dcr_name VARCHAR2(50),
releas_eperson VARCHAR2(200),
bond_type VARCHAR2(10),
first_consignee VARCHAR2(100),
second_consignee VARCHAR2(100),
publish_way VARCHAR2(5),
is_start VARCHAR2(2),
year VARCHAR2(4),
periods VARCHAR2(2),
reg_amount NUMBER(20,2),
benci_amount NUMBER(20,2),
bencibank_amount NUMBER(20,2),
bank_share NUMBER(20,2),
dead_line NUMBER(20),
units VARCHAR2(1),
nianhua_rate NUMBER(20,4),
follow_bank VARCHAR2(10),
rating_org VARCHAR2(32),
rating VARCHAR2(4),
bond_rate VARCHAR2(10),
assure_condition VARCHAR2(2000),
remark VARCHAR2(2000),
eftflag VARCHAR2(1),
stage_code VARCHAR2(15),
create_time TIMESTAMP(6),
create_user VARCHAR2(32),
update_time TIMESTAMP(6),
update_user VARCHAR2(32)
)

@jeffgbutler
Member

I see the issue. The generator is looking for some JSE 1.6 and JSE 1.7 features and the older Oracle drivers don't support that. If you can upgrade your Oracle driver it might fix it. I will also code around this issue for older drivers.

@jeffgbutler jeffgbutler changed the title from find a error to IS_AUTOINCREMENT and IS_GENERATEDCOLUMN Not Supported by Older JDBC Drivers Aug 20, 2016
@jeffgbutler jeffgbutler added the bug label Aug 20, 2016
@jeffgbutler jeffgbutler added this to the 1.3.5 milestone Aug 20, 2016
@jeffgbutler jeffgbutler closed this in #137 Aug 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment