2009-11-17 59 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