I was looking for a way to do this and found another way. Similar to dusty's but I used the <skip> property in a profile. I also had to tell hibernate3 not to drop tables:
<profile> <id>prod</id> <activation> <property><name>prod</name></property> </activation> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>dbunit-maven-plugin</artifactId> <configuration> <skip>true</skip> </configuration> </plugin> </plugins> </build> <properties> <!-- This is for hibernate3-maven-plugin --> <drop.tables>false</drop.tables> </properties> </profile> dusty wrote: > > There are a few things you can do. The first is move dbunit and > hibernate to their own profiles. Then when you want them you can > include -Pdb-setup or -Pdb-reset or whatever you name the profiles. > So if I want to create the production database and seed it with data > you would use -Pprod,db-setup,db-reset. This way you don't accidently > wipe out your prod database with dbunit. Been there, thank god for > good dbas. > > Also having the hibernate plugin drop and create has it's uses, but > you may want to change the <drop>true</drop> to <update>true</update> > in the dbunit config. It will only update your schema if your model > changes and then only the affected parts. > > On May 8, 2009, at 10:02 AM, "Bini MukundanVisalakshy" > <bini.mukundanvisalak...@doj.ca.gov > > wrote: > >> In the pom.xml, just comment out dbunit-maven-plugin >> This is what i did to avoid that. >> >> see the following section for example:It worked out for me. >> But when you build you can see it is trying create the table and >> unsuccessful messages. It won't create any build error. >> I couldn't find out the section to avoid that too. >> Hope this will be helpful at least to avoid the automatic dropping. >> >> Thanks, >> Bini >> >> >> <!-- >> <plugin> >> <groupId>org.codehaus.mojo</groupId> >> <artifactId>dbunit-maven-plugin</artifactId> >> <version>1.0-beta-1</version> >> <configuration> >> <dataTypeFactoryName>$ >> {dbunit.dataTypeFactoryName}</dataTypeFactoryName> >> <driver>${jdbc.driverClassName}</driver> >> <username>${jdbc.username}</username> >> <password>${jdbc.password}</password> >> <url>${jdbc.url}</url> >> <src>src/test/resources/sample-data.xml</src> >> <type>${dbunit.operation.type}</type> >> <schema>${dbunit.schema}</schema> >> <skip>${maven.test.skip}</skip>--> >> <!-- <type>CLEAN_INSERT</type> --> <!-- >> <type>NONE</type> >> </configuration> >> <executions> >> <execution> >> <id>test-compile</id> >> <phase>test-compile</phase> >> <goals> >> <goal>operation</goal> >> </goals> >> </execution> >> <execution> --> >> <!-- Runs before integration tests and >> jetty:run-war --> >> <!-- <id>test</id> >> <phase>test</phase> >> <goals> >> <goal>operation</goal> >> </goals> >> </execution> >> </executions> >> <dependencies> >> <dependency> >> <groupId>${jdbc.groupId}</groupId> >> <artifactId>${jdbc.artifactId}</artifactId> >> <version>${jdbc.version}</version> >> </dependency> >> </dependencies> >> </plugin> >> --> >> >> >> >>>>> malteseunderdog <j...@javaclass.co.uk> 5/8/2009 9:50 AM >>> >> >> >> Hi can anyone tell me how to turn off the automatic dropping and re- >> creation >> of the tables (who wants this ? after spending half an hour >> importing test >> data!). >> >> This is really annoying and you would think this question FAQ >> material (it >> is not). I looked all over the place for an answer - I must be thick. >> >> Many Thanks - Appfuse is great! Well done! >> JP >> -- >> View this message in context: >> http://www.nabble.com/Turn-off-CLEAN_INSERT-behaviour-%28appfuse%2C-dbunit%29-tp23449545s2369p23449545.html >> Sent from the AppFuse - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net >> For additional commands, e-mail: users-h...@appfuse.dev.java.net >> >> >> >> CONFIDENTIALITY NOTICE: This communication with its contents may >> contain confidential and/or legally privileged information. It is >> solely for the use of the intended recipient(s). Unauthorized >> interception, review, use or disclosure is prohibited and may >> violate applicable laws including the Electronic Communications >> Privacy Act. If you are not the intended recipient, please contact >> the sender and destroy all copies of the communication. >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net >> For additional commands, e-mail: users-h...@appfuse.dev.java.net >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net > For additional commands, e-mail: users-h...@appfuse.dev.java.net > > > -- View this message in context: http://www.nabble.com/Turn-off-CLEAN_INSERT-behaviour-%28appfuse%2C-dbunit%29-tp23449545s2369p24079061.html Sent from the AppFuse - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net For additional commands, e-mail: users-h...@appfuse.dev.java.net