使用 Hibernate 和嵌入式 derby
我想在独立应用程序中使用hibernate和嵌入式derby,我有一些问题:
- 我需要什么jar?
- hibernate需要哪些配置?
- 还有其他必要的配置吗?
- 查询/标准是否有任何问题/限制?
如果您还可以建议我一些关于这种方法的好的教程,那就更好了,提前致谢。
i want to use hibernate with embedded derby in a standalone application, and i have some questions:
- What jars do i need ?
- What are the necessary hibernate configuration ?
- Are there any other necessary configuration ?
- Does it have any problems/limitations with queries/criteria ?
if you can also suggest me some good tutorial for this approach that will be preferable, thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用 Apache Derby 和 Hibernate 来测试我的项目的模型类之一(它们的等于、hashCode 实现、查询等)。 MySQL用作生产数据库。我选择 Derby 而不是 HSQLDB,因为我遇到了与 Hibernate 和 HSQLDB 的一些不兼容问题,也就是说,给定我的实体(它们的名称、架构、键) )及其关系 Hibernate 无法在 HSQLDB 中创建我的数据库模式,而可以使用 Derby。也就是说,也许我搞砸了一些事情;不兼容问题也可以得到解决。
无论如何,这是我在测试中使用的内容(我修改了我的 pom.xml,以便它将 Derby 作为运行时依赖项包含在内并运行单个测试,只需以确保其正常工作)。
pom.xml
persistence.xml
Test
实体测试
I use Apache Derby with Hibernate for testing one of my project's model classes (their equals, hashCode implementations, queries, etc.). MySQL is used as the production database. I choose Derby instead of HSQLDB, because I've experienced some incompatibilities with Hibernate and HSQLDB, meaning, given my entities (their name, schema, keys) and their relation Hibernate couldn't create my database schema in HSQLDB, while it could with Derby. That said, maybe I messed up something; also the incompatibilities could have been resolved.
Anyway, here is what I use in my tests (I've modified my
pom.xml
so that it would include Derby as a runtime dependency and run a single test, just to make sure it's working).pom.xml
persistence.xml
Test
entityTest