问题描述
我对整个JPA后端有200多个单元测试,它们在hsql db 2.2上都可以很好地工作.我有在连续构建环境中运行的测试,以验证系统的稳定性.除了当我在Oracle 11上运行它们时,有些测试由于引用完整性约束而失败.这是由于我的代码中的一个错误,但是我在hsqldb中找不到它们的事实使我感到担忧,并且在不真正符合内存的情况下违反了与jpa兼容的轻量级数据库的整个观点!
I have over 200 unit tests for my entire JPA backend and they all work great on hsql db 2.2. I have the tests running in a continuous build environment to verify the stability of the system. Except that when I ran them on Oracle 11, some tests failed with referential integrity constraints. It was due to a bug in my code but the fact that I couldn't find them in hsqldb concerns me and violates the whole point of having a lightweight-in-memory-jpa-compliant db when it's not really compliant!
是否存在可以触发hsqldb在运行测试时考虑参照完整性的设置.我怀疑默认情况下会忽略它们.这些是我的jdbc设置:
Is there a setting that I can trigger for hsqldb to consider referntial integrity while running tests. I suspect they are ignored by default. These are my jdbc settings:
jdbc.driver=org.hsqldb.jdbcDriver
jdbc.url=jdbc:hsqldb:mem:SampleProject
jdbc.username=sa
jdbc.password=
推荐答案
您可以使用:设置数据库参考完整性错误"和"SET DATABASE REFERENTIAL INTEGRITY TRUE" sql语句
You can use:"SET DATABASE REFERENTIAL INTEGRITY FALSE"and"SET DATABASE REFERENTIAL INTEGRITY TRUE" sql statements
这篇关于如何在HSQL Db内存单元测试中启用引用完整性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!