We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
@Bean public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception { SqlSessionFactoryBean factory = new FlexSqlSessionFactoryBean(); factory.setDataSource(dataSource); factory.setVfs(SpringBootVFS.class); FlexConfiguration configuration = new FlexConfiguration(); configuration.setMapUnderscoreToCamelCase(false); factory.setConfiguration(configuration); return factory.getObject(); }
原因为创建表信息对象时,只获取了注解的信息,并没有从配置中加载!!
TableInfoFactory::createTableInfo
private static TableInfo createTableInfo(Class<?> entityClass) { TableInfo tableInfo = new TableInfo(); tableInfo.setEntityClass(entityClass); Reflector reflector = Reflectors.of(entityClass); tableInfo.setReflector(reflector); // 初始化表名 Table table = entityClass.getAnnotation(Table.class); if (table == null) { TableRef vo = entityClass.getAnnotation(TableRef.class); if (vo != null) { TableInfo refTableInfo = ofEntityClass(vo.value()); // 设置 VO 类对应的真实的表名 tableInfo.setSchema(refTableInfo.getSchema()); tableInfo.setTableName(refTableInfo.getTableName()); // 将 @Table 注解的属性复制到 VO 类当中 if (vo.copyTableProps()) { tableInfo.setComment(refTableInfo.getComment()); tableInfo.setCamelToUnderline(refTableInfo.isCamelToUnderline()); tableInfo.setDataSource(refTableInfo.getDataSource()); tableInfo.setOnSetListeners(refTableInfo.getOnSetListeners()); tableInfo.setOnInsertColumns(refTableInfo.getOnInsertColumns()); tableInfo.setOnUpdateListeners(refTableInfo.getOnUpdateListeners()); } } else { // 默认为类名转驼峰下划线 String tableName = StringUtil.camelToUnderline(entityClass.getSimpleName()); tableInfo.setTableName(tableName); } } else { tableInfo.setSchema(table.schema()); tableInfo.setTableName(table.value()); tableInfo.setCamelToUnderline(table.camelToUnderline()); tableInfo.setComment(table.comment()); if (table.onInsert().length > 0) { List<InsertListener> insertListeners = Arrays.stream(table.onInsert()) .filter(listener -> listener != NoneListener.class) .map(ClassUtil::newInstance) .collect(Collectors.toList()); tableInfo.setOnInsertListeners(insertListeners); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
原因为创建表信息对象时,只获取了注解的信息,并没有从配置中加载!!
TableInfoFactory::createTableInfo
The text was updated successfully, but these errors were encountered: