Finally, I found a way to export single tables. Use dbunit and the 'export'
goal. In the configuration
section, define the tables you want to export. Here is an example:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>dbunit-maven-plugin</artifactId>
<configuration>
<src>src/main/resources/default-data.xml</src>
<tables>
<table><name>app_user</name></table>
<table><name>role</name></table>
<table><name>user_role</name></table>
</tables>
<skip>false</skip>
<dest>src/main/resources/user-data.xml</dest>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>export</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>operation</goal>
</goals>
</execution>
</executions>
</plugin>
Explanation: in the 'validate' phase, I export the user data tables to the
user-data.xml file. In between
export and clean insert, I create a new default-data.xml that bases on
user-data.xml with some
additional tables. I've put the goals into different phases because I could
not manage to define the
execution order of plugin goals that reside in the same phase.
Unfortunately, there is little documentation on exporting tables. However,
here is a link to the
official example pom:
http://svn.codehaus.org/mojo/trunk/mojo/dbunit-maven-plugin/src/example/pom.xml
Cheers,
Martin
Martin Homik wrote:
>
> Hmmm ... I couldn't find any information. And the maven parameters don't
> look like it'll be possible to address single tables. :-)
>
> Has anyone else tried this?
>
> Martin
>
>
> mraible wrote:
>>
>> Yes, it should be possible. It is with Ant.
>>
>> http://mojo.codehaus.org/dbunit-maven-plugin/
>>
>> Matt
>>
>> On Wed, Sep 3, 2008 at 8:15 AM, Martin Homik <[EMAIL PROTECTED]> wrote:
>>>
>>> Is it possible to import/export/drop/ (include/exclude) single tables
>>> with
>>> dbunit?
>>> Possibly via <configuration>?
>>>
>>> Scenario: In a nightly process I drop the tables, get data from another
>>> application,
>>> create a flat xml default-data.xml file and repopulate the database.
>>> Since I
>>> do not want
>>> to loose users/roles, I'd like either
>>>
>>> a) to export user/role tables and add the newly generated data
>>> b) drop all tables except for user/role and populate the DB with newly
>>> generated data
>>>
>>> Any ideas?
>>> --
>>> View this message in context:
>>> http://www.nabble.com/dbunit-and-single-tables-tp19290181s2369p19290181.html
>>> Sent from the AppFuse - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/dbunit-and-single-tables-tp19290181s2369p19409516.html
Sent from the AppFuse - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]