当前使用版本(必填,否则不予处理)
3.5.3
该问题是如何引起的?(确定最新版也有问题再提!!!)
public List<Table> getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) {
List<Table> tables = new ArrayList<>();
try (ResultSet resultSet = databaseMetaData.getTables(catalog, schemaPattern, tableNamePattern, types)) {
Table table;
while (resultSet.next()) {
table = new Table();
table.name = resultSet.getString("TABLE_NAME");
table.remarks = formatComment(resultSet.getString("REMARKS"));
table.tableType = resultSet.getString("TABLE_TYPE");
tables.add(table);
}
} catch (SQLException e) {
throw new RuntimeException("读取数据库表信息出现错误", e);
}
return tables;
}
由于采用是从schema中获取,非mysql的库中拿不到table信息
重现步骤(如果有就写完整)
连接非mysql的mysql协议的数据库,如doris, starrocks, tidb等
报错信息
15:21:34.885 [main] WARN com.baomidou.mybatisplus.generator.query.DefaultQuery - 表[resource_collect_events]在数据库中不存在!!!
Comment From: xysoko
查看starrocks中的tableType为 “BASE TABLE”
Comment From: xysoko
DataSourceConfig.Builder builder1 = new DataSourceConfig.Builder(url, username, password);
builder1.databaseQueryClass(SQLQuery.class);
FastAutoGenerator fastAutoGenerator = FastAutoGenerator.create(builder1)
用SQLQuery解决