德比序列循环在junit测试中 [英] Derby Sequence Loop in junit test

查看:168
本文介绍了德比序列循环在junit测试中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用带有Hibernate(hibernate-core-3.6.8.Final)环境的JUNIT中使用带有嵌入式驱动程序(derby-10.9.1.0)和内存数据库的Derby时,遇到了麻烦。


$ b

我使用注释并使用hbm2ddl来创建我的内存数据库。



除了当我尝试使用序列。创建序列(它出现在日志中),但是当我尝试添加一个与该序列相关的PK实体(hibernate)时,我的代码启动了一个无限循环写入每行:

  Hibernate:值为app.SE_FERI的下一个值

我的数据库创建为:

  jdbc :derby:memory:testdb; create = true 

我在代码中使用hbm2ddl,数据库使用,如:
$ b $ pre $ $ $ c $ SchemaExport schemaExport = new SchemaExport(config);
schemaExport.drop(true,true);
schemaExport.create(true,true);

有些帮助!?

解决方案

当序列的allocationSize设置为1时,会发生此问题。将它设置为大于1的值适用于我。



我知道这个线程是有点老,但如果任何人有这个问题,这可能是解决方案。



编辑:拼写


I'm in trouble when using Derby with embedded driver (derby-10.9.1.0) and in-memory db in my JUNIT with Hibernate (hibernate-core-3.6.8.Final) environment.

I'm using annotations and using hbm2ddl to create my in-memory db.

Everything is working except when I try to use an sequence.

The sequence is created (it appears in the log), but when I try to add one entity (hibernate) with PK related to that sequence my code starts a infinite loop writing in each line:

Hibernate: values next value for app.SE_FERI

My db is created as:

jdbc:derby:memory:testdb;create=true

I'm using hbm2ddl inside my code, before the database use, as:

SchemaExport schemaExport = new SchemaExport(config);
schemaExport.drop(true, true);
schemaExport.create(true, true);

Some help !?

解决方案

This problem occurres when the allocationSize of the sequence is set to 1. Setting it to a value > 1 worked for me.

I know this thread is kinda old, but if anybody else has this problem, this could be the solution.

Edit: spelling

这篇关于德比序列循环在junit测试中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆