[英]Unitils / DBunit / Oracle - how to insert dataset in oracle views?
It seems to be a simple question.这似乎是一个简单的问题。 I have some unitils tests in a spring application.
我在 spring 应用程序中有一些 unitils 测试。 The database contains some oracle views and i just want to insert dataset into these views.
该数据库包含一些 oracle 视图,我只想将数据集插入这些视图。 I know that it is possible to set options to DBunit (Table Type properties).
我知道可以将选项设置为 DBunit(表类型属性)。 But i find nothing for unitils.
但我找不到单位。
Is there some unitils properties for inserting dataset to views?是否有一些用于将数据集插入视图的 unitils 属性?
Thank you for help谢谢你的帮助
Ok i think i find a way to configure unitils.好的,我想我找到了一种配置单位的方法。 But that needs some java code.
但这需要一些 java 代码。 I have tested this solution, it seems to work.
我已经测试了这个解决方案,它似乎有效。
First i find some properties in unitils (unitils.properties):首先,我在 unitils (unitils.properties) 中找到了一些属性:
unitils.module.dbunit.className=org.unitils.dbunit.DbUnitModule
unitils.module.dbunit.runAfter=
unitils.module.dbunit.enabled=true
So it seems to be possible to override DBUnitModule like this所以似乎可以像这样覆盖 DBUnitModule
public class DbUnitModule extends org.unitils.dbunit.DbUnitModule implements Module {
/*
* (non-Javadoc)
*
* @see org.unitils.dbunit.DbUnitModule#getDbUnitDatabaseConnection(java.lang.String)
*/
@Override
public DbUnitDatabaseConnection getDbUnitDatabaseConnection(final String schemaName) {
DbUnitDatabaseConnection dbConnection = super.getDbUnitDatabaseConnection(schemaName);
dbConnection.getConfig().setProperty("http://www.dbunit.org/properties/tableType", new String[] { "VIEW", "TABLE" });
return dbConnection;
}
}
And then modify the configuration in unitils.properties.然后修改unitils.properties中的配置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.