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 had a similar issue. You cannot with the annotation however you can specify the schema on the connection string. Here is how I solved my case:
In my case I was using HSQLDB but it is applicable for other databases as well
If you are using the spring-test-dbunit then you need to create an IDatabaseConnection with a specific DBUnit configuration. Following the doc's example I've setup this one for me:
I used this trick. First, we need OracleConnection bean:
Then you can use this annotation in your methods
Hope it helps.