我有使用derby的单元测试(在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 config:
<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"/>
最后行家:
<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>
最佳答案
您可以尝试使用hibernate.connection.autocommit=true
吗?它帮助我解决了Maven Hibernate3插件的一些问题(请参阅HBX-1145)。不确定是否相关。
关于maven-2 - Derby 卡住了吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1746050/