<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>hsqlDB</id>
<phase>test-compile</phase>
<goals>
<goal>hbm2ddl</goal>
</goals>
<configuration>
<components>
<component>
<name>hbm2ddl</name>
<implementation>annotationconfiguration</implementation>
</component>
</components>
<componentProperties>
<jdk5>true</jdk5>
<propertyfile>target/test-classes/hibernateconf.properties</propertyfile>
<configurationfile>target/test-classes/hibernate.cfg.xml</configurationfile>
<skip>${skipTests}</skip>
</componentProperties>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</plugin>
hibernateconf.properties 포함 :
이
는 최대 절전 모드 플러그인 코드hibernate.dialect=org.hibernate.dialect.HSQLDialect
hibernate.connection.driver_class=org.hsqldb.jdbcDriver
hibernate.connection.url=jdbc:hsqldb:mem:mytestdb;hsqldb.write_delay=false;shutdown=true
hibernate.connection.username=sa
hibernate.connection.password=
hibernate.connection.pool_size=1
hibernate.hbm2ddl.auto=create-drop
그리고 이것은 DBUnit를
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>dbunit-maven-plugin</artifactId>
<version>1.0-beta-3</version>
<configuration>
<dataTypeFactoryName>org.dbunit.ext.hsqldb.HsqldbDataTypeFactory</dataTypeFactoryName>
<driver>org.hsqldb.jdbcDriver</driver>
<username>sa</username>
<password></password>
<url>jdbc:hsqldb:mem:mytestdb;shutdown=true;hsqldb.write_delay=false</url>
<src>src/test/resources/sample-data.xml</src>
<type>CLEAN_INSERT</type>
<skip>${skipTests}</skip>
<transaction>true</transaction>
<skipOracleRecycleBinTables>true</skipOracleRecycleBinTables>
</configuration>
<executions>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>operation</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</plugin>
입니다 그리고 이것은 오류 메시지입니다 :
Caused by: org.dbunit.dataset.NoSuchTableException: ExamplePersonEntity
at org.dbunit.database.DatabaseDataSet.getTableMetaData(DatabaseDataSet.java:281)
¿ 어떤 사람은 어떤 생각을 가지고 있습니까?
덕분에 많은
답장을 보내 주셔서 감사합니다.하지만 그 일은 나에게 도움이되지 못했습니다. 원래 이러한 db urls가 있었지만 결과가 나타나지 않았기 때문에 shutdown 매개 변수와 hsqldb.write_delay를 사용하기 시작했습니다. 어떤 경우에 주셔서 감사합니다 :) –
확실히 shutdown = false로 작동하지 않으면 hibernate 및 dbunit에 다른 Java 프로세스를 사용 중입니다. 이 유형의 설정에서는 메모리 데이터베이스가있는 HSQLDB 서버를 사용해야합니다. – fredt