Is it possible to set the table schema name when using @DatabaseSetup
annotation from Spring Test DBUnit? Currently I'm using it like this:
@DatabaseSetup("user-data.xml")
public class UserMapperTest {
}
user-data.xml: (I also tried to set the element name to user.system_user without any luck)
<dataset>
<system_user
...
/>
</dataset>
And here I'm creating my table with schema called user:
create table "user".system_user (...);
And this is the exception that I get when running test:
org.h2.jdbc.JdbcSQLException: Table "SYSTEM_USER" not found; SQL statement:
delete from SYSTEM_USER [42102-175]
I used this trick. First, we need OracleConnection bean:
<bean id="oracleConnection" class="org.dbunit.ext.oracle.OracleConnection">
<constructor-arg value="#{dataSource.getConnection()}"/>
<constructor-arg value="<your_scheme_name>"/>
</bean>
Then you can use this annotation in your methods
@DbUnitConfiguration(databaseConnection = "oracleConnection")
@DatabaseSetup(...)
Hope it helps.