Java Swing 应用程序可使用哪种 Hibernate 兼容嵌入式数据库?
我将实现一个 Java Swing 应用程序。起初,我想使用 Apache Derby DB,因为我需要一个嵌入式数据库。
但事实证明它与 hibernate 配合得不好 (https://forum.hibernate.org/viewtopic.php?f=6&t=1003258&p=2433546#p2433546,Netbeans + derby + hibernate)。
Hibernate 忽略自动生成的键和外键...
您能推荐一些可以嵌入并与 Hibernate 很好地配合使用的 DB,或者告诉我如何使 Derby 与 Hibernate 很好地配合使用吗?
I will be implementing a Java Swing app. At first, I wanted to use Apache Derby DB, because I needed an embedded DB.
But it turned out that it does not plays nice with hibernate (https://forum.hibernate.org/viewtopic.php?f=6&t=1003258&p=2433546#p2433546, Netbeans + derby + hibernate).
Hibernate ignores auto generated keys and foreign keys...
Can you recommend some DB that can be embedded and nicely used with Hibernate, or tell me how to make Derby work well with Hibernate?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我更喜欢h2,即“高超音速2”。请参阅http://www.h2database.com/html/features.html#comparison 进行比较。
I prefer h2, the "Hypersonic 2". See http://www.h2database.com/html/features.html#comparison for a comparsion.
尝试 Hypersonic SQL。
Try Hypersonic SQL.
你有没有想过嵌入式MySQL
Have you thought of MySQL embedded
总而言之,我测试了 Derby 和 HSQL,尝试使用 netbeans 制作简单的 hibernate CRUD 应用程序。
如果您不想担心生成主键,则需要手动更改它们,这没什么大不了的。
但是,derby pojos 和映射文件完全忽略外部表引用,没有尝试手动添加它们,但 netbeans 不会生成它们。
HSQL不存在这个问题。
人们抱怨数据损坏和不一致,他们从 HSQL 迁移到 Derby,再从 Derby 迁移到 HSQL。
我不知道 HSQL 是否适合我和我的生产用途。我会在桌面应用程序的嵌入模式下使用它,并在网络使用中使用一个版本,它可能会在服务器模式下,所以两者都是。
欢迎所有建议。
All in all, I tested Derby and HSQL, tried to make simple hibernate CRUD app with netbeans.
Both of them set which you need to manually change to if you don't want to worry about generating primary keys, which is not a big deal.
But, derby pojos and mapping files totally ignore foreign table references, didn't tried to add them by hand, but netbeans does not generate them.
HSQL does not have this problem.
People are complaining about corrupted data and inconsistency, they are migrating from HSQL to Derby and from Derby to HSQL.
I don't know if HSQL is good for me and my production use. I would use it in embeded mode for desktop app, and one version for network usage, where it will be in server mode probably, so both.
All suggestions are welcome.