maven-2 - Derby 卡住了吗?

标签 maven-2 derby surefire

我有使用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/

相关文章:

java - 在 Netbeans 中使用 Derby EmbeddedDriver

scala - 是否有使用简单构建工具生成万无一失的报告的现有方法?

unit-testing - 在运行 “maven clean install”和Sonar时,如何只运行一次单元测试?

java - 代码中不属于我的回调导致 TestNG 单元测试失败

apache-flex - 如何将 maven 依赖项添加到 Flex Builder 3 中的 flex 构建路径?

indexing - 向Derby数据库表添加索引

java - 如何从不同的存储库添加 Maven 依赖项

java - 使用 EJB 和 JPA 保留带有外键的表

eclipse - 不使用 m2eclipse 插件自动格式化 pom.xml

maven-2 - 有没有办法根据 cron 规则安排 Jenkins 作业与不同版本的 Maven 一起运行?