mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
修复oracle代码生成获取不到注释问题
This commit is contained in:
parent
c984880c93
commit
65b802a259
@ -5,13 +5,11 @@
|
||||
<parent>
|
||||
<artifactId>parent</artifactId>
|
||||
<groupId>com.mybatis-flex</groupId>
|
||||
<version>1.4.9</version>
|
||||
<version>1.3.9</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>mybatis-flex-codegen</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
@ -29,7 +27,7 @@
|
||||
<dependency>
|
||||
<groupId>com.mybatis-flex</groupId>
|
||||
<artifactId>mybatis-flex-spring</artifactId>
|
||||
<version>${mybatis-flex.version}</version>
|
||||
<version>1.3.9</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
@ -50,6 +48,11 @@
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.oracle.ojdbc</groupId>
|
||||
<artifactId>ojdbc8</artifactId>
|
||||
<version>19.3.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.xerial</groupId>
|
||||
|
||||
@ -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<Field>() {
|
||||
@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);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user