I am trying to export a portion of my db using the db-unit-maven plugin. I set the ordered flag set to true in my configuration so that I can re-import it avoiding integrity constraint violation. I also specify what tables to export using the tables element inside the configuration. I pasted below an example of what I am trying to do.
However, it exports additional tables that are unrelated in terms of constraints to those manually selected in the configuration. Does <ordered>true</order>
cause the list to be ignored? What am I missing?
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>dbunit-maven-plugin</artifactId>
<version>1.0-beta-3</version>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.1.0</version>
</dependency>
</dependencies>
<configuration>
<driver>oracle.jdbc.OracleDriver</driver>
<url>${it.datasource.url}</url>
<username>${dbunit.username}</username>
<password>${dbunit.password}</password>
<dataTypeFactoryName>org.dbunit.ext.oracle.OracleDataTypeFactory</dataTypeFactoryName>
<skipOracleRecycleBinTables>true</skipOracleRecycleBinTables>
</configuration>
<executions>
<execution>
<id>execute</id>
<phase>package</phase>
<goals>
<goal>export</goal>
</goals>
<configuration>
<schema>${dbunit.username}</schema>
<format>xml</format>
<dest>target/dbunit/export.xml</dest>
<tables>
<table name="TABLE_1" />
<table name="TABLE_2" />
</tables>
<ordered>true</ordered>
</configuration>
</execution>
</executions>
</plugin>
It turns out the syntax is wrong. The original pasted above returns a NullPointerException
the correct syntax is pasted below and, as far as I can tell, it behaves as expected.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>dbunit-maven-plugin</artifactId>
<version>1.0-beta-3</version>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.1.0</version>
</dependency>
</dependencies>
<configuration>
<driver>oracle.jdbc.OracleDriver</driver>
<url>${it.datasource.url}</url>
<username>${dbunit.username}</username>
<password>${dbunit.password}</password>
<dataTypeFactoryName>org.dbunit.ext.oracle.OracleDataTypeFactory</dataTypeFactoryName>
<skipOracleRecycleBinTables>true</skipOracleRecycleBinTables>
</configuration>
<executions>
<execution>
<id>execute</id>
<phase>package</phase>
<goals>
<goal>export</goal>
</goals>
<configuration>
<schema>${dbunit.username}</schema>
<format>xml</format>
<dest>target/dbunit/export.xml</dest>
<tables>
<table>
<name>TABLE_1</name>
</table>
<table>
<name>TABLE_2</name>
</table>
</tables>
<ordered>true</ordered>
</configuration>
</execution>
</executions>
</plugin>