2011-12-27 3 views
0

테스트를 실행하기 전에 hibernate3-maven-plugin을 사용하여 스키마를 생성하고 있습니다. 성공적으로 스키마를 작성하고 있지만 성공적으로 삭제하지는 않습니다.hibernate3-maven-plugin으로 데이터베이스가 삭제되지 않습니다.

<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>hibernate3-maven-plugin</artifactId> 
    <version>2.2</version> 
    <executions> 
     <execution> 
      <phase>process-test-classes</phase> 
      <goals> 
       <goal>hbm2ddl</goal> 
      </goals> 
     </execution> 
    </executions> 
    <configuration> 
     <components> 
      <component> 
       <name>hbm2ddl</name> 
       <implementation>annotationconfiguration</implementation> 
      </component> 
     </components> 
     <componentProperties> 
      <implementation>jpaconfiguration</implementation> 
      <persistenceunit>JpaPersistenceUnit</persistenceunit> 
      <configurationfile>src/test/resources/hibernate.cfg.xml</configurationfile> 
     </componentProperties> 
    </configuration> 
    <dependencies> 
     <dependency> 
      <groupId>mysql</groupId> 
      <artifactId>mysql-connector-java</artifactId> 
      <version>5.1.5</version> 
     </dependency> 
    </dependencies> 
</plugin> 

내 최대 절전 XML은 : 당신이, 내가, hbm2ddl.auto = 생성 드롭을 사용하고 볼 수 있듯이

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE hibernate-configuration SYSTEM 
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> 
<hibernate-configuration> 
    <session-factory> 
     <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> 
     <property name="hibernate.connection.url">jdbc:mysql://localhost/db_test</property> 
     <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> 
     <property name="hibernate.connection.username">root</property> 
     <property name="hibernate.connection.password">root</property> 
     <property name="hibernate.connection.pool_size">1</property> 
     <property name="hibernate.show_sql">true</property> 
     <property name="hibernate.hbm2ddl.auto">create-drop</property> 
    </session-factory> 
</hibernate-configuration> 

문서 상태가 드롭한다

내 플러그인 구성

SessionFactory 닫을 때의 db.

[ERROR] Error #1: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'stations' already exists 
[ERROR] Error #1: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'track_scans' already exists 

(I는 현재 두 엔티티있다, 그래서이 적절한 것 같다)

아니에요 : 나는 두 번째 시간 내 테스트를 실행할 때

그러나, 나는 다음과 같은 오류를 참조 여기에서 어디로 가야하는지. 어떤 도움을 주시면 감사하겠습니다.

답변

0

<drop>true</drop>을 플러그인 구성의 componentProperties 섹션에 추가하여 기능적 솔루션을 얻었습니다.

관련 문제