简单可靠的内存数据库,支持快速java集成测试和JPA [英] Simple and reliable in memory database for fast java integration tests with support for JPA

查看:518
本文介绍了简单可靠的内存数据库,支持快速java集成测试和JPA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我使用in-memory-database而不是PostgreSQL,我的集成测试会运行得更快。我使用JPA(Hibernate),我需要一个内存数据库,将很容易切换到使用JPA,易于设置和可靠。它需要支持JPA和Hibernate(或反之亦然,如果你愿意)相当广泛,因为我不想采用我的数据访问代码测试。



什么数据库是 ,我现在使用 H2 (来自HSQLDB的原作者),我更喜欢HSQLDB。这是更快(我希望我的测试尽可能快),它有一些不错的功能,如兼容性模式,开发团队非常敏感(而HSQLDB保持休眠多年来直到最近)。


My integration tests would run much faster if I used in-memory-database instead of PostgreSQL. I use JPA (Hibernate) and I need an in-memory-database that would be easy to switch to using JPA, easy to setup, and reliable. It needs to support JPA and Hibernate (or vice verse if you will) rather extensively since I have no desire to adopt my data access code for tests.

What database is the best choice given requirements above?

解决方案

For integration testing, I now use H2 (from the original author of HSQLDB) that I prefer over HSQLDB. It is faster (and I want my tests to be as fast as possible), it has some nice features like the compatibility mode, the dev team is very responsive (while HSQLDB remained dormant for years until very recently).

这篇关于简单可靠的内存数据库,支持快速java集成测试和JPA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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