开发者

Derby gets stuck closing?

I've got unit tests (in maven) that use derby.

At the end of the test run, there is a very long pause, with these log messages before the pause.

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>

referenced from:

<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"/>

and finally 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开发者_JAVA百科>src/main/hibernate/codegen-hibernate.xml</configurationfile>
                            </componentProperties>
                        </configuration>
                    </execution>
                </executions>
            </plugin>


Could you try with hibernate.connection.autocommit=true? It helped me to solve some problems with the Maven Hibernate3 plugin (see HBX-1145). Not sure it's related though.


I am not sure, if this would still make a difference, but I just thought I'd let you know that I knocked up a derby-maven-plugin a while ago aimed at exactly being able to run tests against a Derby database. You can have a look at the GitHub project here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜