diff --git a/mybatis-flex-codegen/pom.xml b/mybatis-flex-codegen/pom.xml index 3d8d671c..0d03c7c5 100644 --- a/mybatis-flex-codegen/pom.xml +++ b/mybatis-flex-codegen/pom.xml @@ -5,13 +5,11 @@ parent com.mybatis-flex - 1.4.9 + 1.3.9 4.0.0 mybatis-flex-codegen - jar - 8 @@ -29,7 +27,7 @@ com.mybatis-flex mybatis-flex-spring - ${mybatis-flex.version} + 1.3.9 @@ -50,6 +48,11 @@ true + + com.oracle.ojdbc + ojdbc8 + 19.3.0.0 + org.xerial diff --git a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/dialect/IDialect.java b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/dialect/IDialect.java index 2a519707..ae74beb1 100644 --- a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/dialect/IDialect.java +++ b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/dialect/IDialect.java @@ -17,12 +17,17 @@ package com.mybatisflex.codegen.dialect; import com.mybatisflex.codegen.config.GlobalConfig; import com.mybatisflex.codegen.entity.Table; +import com.mybatisflex.core.util.ClassUtil; import com.mybatisflex.core.util.StringUtil; +import com.zaxxer.hikari.pool.HikariProxyConnection; +import java.lang.reflect.Field; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.function.Predicate; +import oracle.jdbc.driver.OracleConnection; /** * 方言接口。 @@ -65,7 +70,22 @@ public interface IDialect { @Override protected ResultSet forRemarks(String schema, Table table, DatabaseMetaData dbMeta, Connection conn) throws SQLException { - return dbMeta.getColumns(conn.getCatalog(), StringUtil.isNotBlank(schema) ? schema : dbMeta.getUserName(), table.getName(), null); + HikariProxyConnection hikariProxyConnection = (HikariProxyConnection) conn; + Field delegate = ClassUtil.getFirstField(HikariProxyConnection.class, new Predicate() { + @Override + public boolean test(Field field) { + return field.getName().equals("delegate"); + } + }); + delegate.setAccessible(true); + OracleConnection oc; + try { + oc = (OracleConnection) delegate.get(hikariProxyConnection); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + oc.setRemarksReporting(true); + return dbMeta.getColumns(oc.getCatalog(), StringUtil.isNotBlank(schema) ? schema : dbMeta.getUserName(), table.getName(), null); } };