gpt4 book ai didi

java - DbUnit - 警告 : AbstractTableMetaData

转载 作者:太空狗 更新时间:2023-10-29 22:31:27 24 4
gpt4 key购买 nike

我在最新版本 2.4.8 中使用 DbUnit,我在我的单元测试中收到许多警告消息:

WARN : org.dbunit.dataset.AbstractTableMetaData - 
Potential problem found: The configured data type factory
'class org.dbunit.dataset.datatype.DefaultDataTypeFactory'
might cause problems with the current database 'MySQL' (e.g. some datatypes may
not be supported properly). In rare cases you might see this message because the
list of supported database products is incomplete (list=[derby]). If so please
request a java-class update via the forums.If you are using your own
IDataTypeFactory extending DefaultDataTypeFactory, ensure that you override
getValidDbProducts() to specify the supported database products.

所以我想我添加这个(我使用 MySQL 数据库):

protected void setUpDatabaseConfig(DatabaseConfig config) {
config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new MySqlDataTypeFactory());
}

但这无助于避免这些警告。这里有什么问题吗?

在此先感谢您,并向蒂姆致以最诚挚的问候。

最佳答案

我用来自 dbunit faq 的信息解决了这个问题.只需设置数据类型工厂属性即可使警告消失。

    Connection dbConn = template.getDataSource().getConnection();

IDatabaseConnection connection = new DatabaseConnection(dbConn, "UTEST", false);

DatabaseConfig dbConfig = connection.getConfig();

// added this line to get rid of the warning
dbConfig.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new OracleDataTypeFactory());

关于java - DbUnit - 警告 : AbstractTableMetaData,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3942965/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com