-
Notifications
You must be signed in to change notification settings - Fork 4.4k
[错误报告]: 新代码生成器异常 #6765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
select null as table_cat,
owner as table_schem,
table_name,
0 as NON_UNIQUE,
null as index_qualifier,
null as index_name, 0 as type,
0 as ordinal_position, null as column_name,
null as asc_or_desc,
num_rows as cardinality,
blocks as pages,
null as filter_condition
from all_tables
where table_name = 'ETL_DEPENDENT_ON'
and owner = 'BSS_KANYU'
union
select null as table_cat,
i.owner as table_schem,
i.table_name,
decode (i.uniqueness, 'UNIQUE', 0, 1),
null as index_qualifier,
i.index_name,
1 as type,
c.column_position as ordinal_position,
c.column_name,
null as asc_or_desc,
i.distinct_keys as cardinality,
i.leaf_blocks as pages,
null as filter_condition
from all_indexes i, all_ind_columns c
where i.table_name = 'ETL_DEPENDENT_ON'
and i.owner = 'BSS_KANYU'
and i.index_name = c.index_name
and i.table_owner = c.table_owner
and i.table_name = c.table_name
and i.owner = c.index_owner
order by non_unique, type, index_name, ordinal_position 看这SQL能不能在你的数据库里正常执行,如果不行,那你需要更换匹配的ORACLE驱动. |
在pl/sql执行了下还是同样的错误! |
public static class MyDefaultQuery extends DefaultQuery {
public MyDefaultQuery(@NotNull ConfigBuilder configBuilder) {
super(configBuilder);
}
@Override
protected List<DatabaseMetaDataWrapper.Index> getIndex(String tableName) {
return new ArrayList<>();
}
}
// 代码指定
FastAutoGenerator.create(url, username, password)
.dataSourceConfig(ds -> ds.databaseQueryClass(MyDefaultQuery.class)) 如果你无法解决,又不需要索引信息,可以这么修改使用。 |
终于找到原因了,原来在这个库里有一个自建的实体表:all_tables,与代码生成器使用all_tables名字一样,调用时直接调用了这个实体表,所以才出错之前的找不到owner的错误!!! 另外遇到一个场景,我使用3.5.11的生成器,对clickhouse的一张表进行生成,报了错误,这个用3.5.9的生成是没任务错误,正常生成的! 使用你给的方法:
在3.5.11版本,使用上面的,也正常了 ! 针对这两次不同场景中代码生成器遇到的错误,感觉3.5.9版本生成方式,更通用和实用一些,个人建议把这种方式设置成缺省方式,对于需要索引的,做成可配置的!!! 非常感谢 @nieqiurong |
这是什么驱动,规范的驱动查询ResultSet不应该有null返回的情况,你需要检查是驱动行为还是你使用的什么连接池返回了null值。 |
spring boot版本:3.4.4 驱动都官方的标准驱动 使用3.5.11版本的生成器默认数据源的方式
|
public ClickHouseDataSource(String url, Properties properties) throws SQLException {
this.driver = new ClickHouseDriver();
if (driver.isV2(url)) {
//v2
this.dataSource = new com.clickhouse.jdbc.DataSourceImpl(url, properties);
} else {
//v1
this.dataSource = new DataSourceV1(url, properties);
}
} 只能用v1的驱动协议,. |
用3.5.12-SNAPSHOT试试,快照使用参考: https://baomidou.com/getting-started/install |
确认
当前程序版本
3.5.11
问题描述
mybatis plus版本:3.5.11
spring boot版本:3.4.3
使用的新的代码生成器:
异常如下面,堆栈日志
使用3.5.10.1, 3.5.11都有这样异常,使用3.5.9版本正常
详细堆栈日志
The text was updated successfully, but these errors were encountered: