From 65b802a25952626e22672ca42ea1d16d4ca0a2eb Mon Sep 17 00:00:00 2001 From: cgc <1083310255@qq.com> Date: Fri, 14 Jul 2023 13:40:43 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8Doracle=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=94=9F=E6=88=90=E8=8E=B7=E5=8F=96=E4=B8=8D=E5=88=B0=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mybatis-flex-codegen/pom.xml | 11 ++++++---- .../mybatisflex/codegen/dialect/IDialect.java | 22 ++++++++++++++++++- 2 files changed, 28 insertions(+), 5 deletions(-) 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); } }; From 53396bcac0688577461aa15472ae0ecbe9ba6960 Mon Sep 17 00:00:00 2001 From: cgc <1083310255@qq.com> Date: Fri, 14 Jul 2023 13:45:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8Doracle=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=94=9F=E6=88=90=E8=8E=B7=E5=8F=96=E4=B8=8D=E5=88=B0=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mybatis-flex-codegen/pom.xml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/mybatis-flex-codegen/pom.xml b/mybatis-flex-codegen/pom.xml index 0d03c7c5..302c6a6f 100644 --- a/mybatis-flex-codegen/pom.xml +++ b/mybatis-flex-codegen/pom.xml @@ -5,11 +5,13 @@ parent com.mybatis-flex - 1.3.9 + 1.4.9 4.0.0 mybatis-flex-codegen + jar + 8 @@ -27,7 +29,13 @@ com.mybatis-flex mybatis-flex-spring - 1.3.9 + ${mybatis-flex.version} + + + + com.oracle.ojdbc + ojdbc8 + 19.3.0.0 @@ -48,11 +56,6 @@ true - - com.oracle.ojdbc - ojdbc8 - 19.3.0.0 - org.xerial