Derby Sequence Loop in junit test

吃可爱长大的小学妹 提交于 2019-12-21 17:29:39

问题


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 !?


回答1:


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



来源:https://stackoverflow.com/questions/12975279/derby-sequence-loop-in-junit-test

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!