2009-11-17 82 views
2

我有使用德比的單元測試(在maven中)。德比卡住了嗎?

在測試運行結束時,會有一段非常長的暫停,並在暫停之前包含這些日誌消息。

INFO: Closing Hibernate SessionFactory 
Nov 16, 2009 8:30:31 PM org.hibernate.impl.SessionFactoryImpl close 
INFO: closing 
Nov 16, 2009 8:30:31 PM org.hibernate.tool.hbm2ddl.SchemaExport execute 
INFO: Running hbm2ddl schema export 
Nov 16, 2009 8:30:31 PM org.hibernate.tool.hbm2ddl.SchemaExport execute 
INFO: exporting generated schema to database

Hibernate的配置:

<hibernate-configuration> 
    <session-factory> 
     <property name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</property> 
     <property name="hbm2ddl.auto">create-drop</property> 
     <property name="show_sql">false</property> 
    </session-factory> 
</hibernate-configuration> 

從引用:

<bean id="sessionFactory" 
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> 
    <!-- data source elsewhere --> 
    <property name="dataSource" ref="dataSource" /> 
    <property name="mappingResources"> 
     <list> 
     <value>com/basistech/configdb/dao/Gazetteer.hbm.xml</value> 
     <value>com/basistech/configdb/dao/FileGazetteer.hbm.xml</value> 
     <value>com/basistech/configdb/dao/Regexpset.hbm.xml</value> 
     <value>com/basistech/configdb/dao/Redactjoiner.hbm.xml</value> 
     <value>com/basistech/configdb/dao/Misc.hbm.xml</value> 
     </list> 
    </property> 
    <property name="configLocation" value="classpath:com/basistech/configdb/dao/hibernate.xml"/> 

終於Maven的:

<plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>hibernate3-maven-plugin</artifactId> 
       <version>2.2</version> 
       <executions> 
        <execution> 
         <id>codegen</id> 
         <goals> 
          <goal>hbm2java</goal> 
         </goals> 
         <phase>generate-sources</phase> 
         <configuration> 
          <components> 
          <component> 
           <name>hbm2java</name> 
          </component> 
          </components> 
          <componentProperties> 
           <configurationfile>src/main/hibernate/codegen-hibernate.xml</configurationfile> 
          </componentProperties> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
+0

這裏沒有足夠的細節給出答案。請提供您的hibernate和/或hibernate3-maven插件配置。這將有所幫助。 – 2009-11-17 10:26:41

+0

看起來像一切正常對我來說 – 2009-11-17 13:27:12

+0

除了1分鐘的暫停。爲什麼要在最後一段時間序列化模式? – bmargulies 2009-11-17 13:41:25

回答

0

你可以試試hibernate.connection.autocommit=true?它幫助我解決了Maven Hibernate3插件的一些問題(請參閱HBX-1145)。不確定它是相關的。

0

我不確定,如果這仍然會有所作爲,但我只是想讓我知道我前段時間敲了一個德比 - 瑪芬插件,目的是爲了能夠正確地運行測試德比數據庫。你可以看看GitHub項目here