<dataset>
<user id="1" created_date='2017-01-01 00:00:00' email="" user_name="root"/>
</dataset>
xml above gives me error. The problem is i have reserved word for user. how can I solve this. any links?
updated
I am using spring boot, spring data jpa, spring-test-dbunit, dbunit, postgresql
According to this forum https://sourceforge.net/p/dbunit/mailman/message/20643023/ it doesn’t seem like DBUnit has a way to “quote” the table name. But you can configure DatabaseDataSourceConnectionFactoryBean
if you do not want to rename tables for some reason or working with legacy database
@Configuration
public class Custom.... {
@Autowired
private DataSource dataSource;
@Bean
public DatabaseConfigBean dbUnitDatabaseConfig() {
DatabaseConfigBean dbConfigBean = new DatabaseConfigBean();
// dbConfigBean.setDatatypeFactory(new PostgresqlDataTypeFactory());
dbConfigBean.setQualifiedTableNames(true);
return dbConfigBean;
}
@Bean
public DatabaseDataSourceConnectionFactoryBean dbUnitDatabaseConnection() {
DatabaseDataSourceConnectionFactoryBean databaseDataSourceConnectionFactoryBean = new DatabaseDataSourceConnectionFactoryBean(dataSource);
databaseDataSourceConnectionFactoryBean.setDatabaseConfig(dbUnitDatabaseConfig());
return databaseDataSourceConnectionFactoryBean;
}
}
After setting true to qualifiedTableNames you should give full name for ur tables in xml
<public.user id="1" created_date='2017-01-01 00:00:00' email="root@demo.io" password="your password" username="root"/>