Change the the default database to hsqldb in the end of the pom:
<!-- Database settings --> <dbunit.dataTypeFactoryName>org.dbunit.ext.hsqldb.HsqldbDataTypeFactory</dbunit.dataTypeFactoryName> <dbunit.operation.type>CLEAN_INSERT</dbunit.operation.type> <hibernate.dialect>org.hibernate.dialect.HSQLDialect</hibernate.dialect> <project.tmpdir>tmp</project.tmpdir> <jdbc.groupId>hsqldb</jdbc.groupId> <jdbc.artifactId>hsqldb</jdbc.artifactId> <jdbc.version>1.8.0.7</jdbc.version> <jdbc.driverClassName>org.hsqldb.jdbcDriver</jdbc.driverClassName> <jdbc.url><![CDATA[jdbc:hsqldb:tmp/comped;shutdown=true]]></jdbc.url> <jdbc.username>sa</jdbc.username> <jdbc.password></jdbc.password> Add a profile for production use, such as: <!-- ================= Production Settings Profile ================= --> <!-- Use "-P prod" when you want to run production mode --> <!-- =============================================================== --> <profile><id>prod</id> <build> <plugins> <plugin> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skip>true</skip> </configuration> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>dbunit-maven-plugin</artifactId> <version>1.0-beta-1</version> <configuration> <skip>true</skip> </configuration> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>hibernate3-maven-plugin</artifactId> <version>2.1</version> <configuration> <components> <component> <name>hbm2ddl</name> <implementation>annotationconfiguration</implementation> </component> </components> <componentProperties> <drop>false</drop> <jdk5>true</jdk5> <propertyfile>target/classes/jdbc.properties</propertyfile> <skip>true</skip> </componentProperties> </configuration> </plugin> </plugins> </build> <properties> <jdbc.groupId>mysql</jdbc.groupId> <jdbc.artifactId>mysql-connector-java</jdbc.artifactId> <jdbc.version>5.0.5</jdbc.version> <hibernate.dialect>org.hibernate.dialect.MySQL5InnoDBDialect</hibernate.dialect> <jdbc.driverClassName>com.mysql.jdbc.Driver</jdbc.driverClassName> <jdbc.url><![CDATA[jdbc:mysql://localhost/db_prod?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf-8]]></jdbc.url> <jdbc.username>someone</jdbc.username> <jdbc.password>something</jdbc.password> </properties> </profile> This profile skips hibernate3, dbunit repopulation and the test plugins. Hope, that helps. Martin Tarjei Huse wrote: > > Hi, I'm using Appfuse with hibernate and I want to run my unit/integration > tests in HSQLDB (or a different in-memory database) but use mysql for my > production environment as well as my staging environment. > > Basically: > Run the test phase using HSQLDB, but switch to using mysql for mvn > jetty:run-war or mvn war -> but then with different username/password > configurations. > > I would guess this is a quite common pattern, so how should it be done? > > I've found some pointers, but I am not completely satisfied with them: > [1] shows how to configure Appfuse to use HSQLDB, but I cannot find where > the xml fragments should go. Also [2] discusses how to do this using > different profiles. > > 1. http://thread.gmane.org/gmane.comp.java.appfuse.user/20476 > 2. http://thread.gmane.org/gmane.comp.java.appfuse.user/28929/focus=29007 > > It seems to me that the best way would be if different profiles could be > activated for different phases (test, jetty:run-war) but that seems to me > not to be possible. > > So, what is the best way to do this? > > Kind regards, > Tarjei > > > > -- View this message in context: http://www.nabble.com/Separate-database-settings-for-testing%2C-staging-and-production-tp19586169s2369p19608115.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]