JPA2 与 MySQL 后端:MyISAM 或 InnoDB
显然,有很多关于 MyISAM 与 InnoDB 引擎选择的信息,但我找不到任何特定于 JPA2 的信息。
是否可以将 MyISAM 引擎与 java 持久化 API 一起使用,并且仍然具有事务支持?或者它是否依赖 RDBMS 提供回滚/提交功能?
是否还需要考虑其他(非显而易见的)因素? @Cascade
怎么样?
Obviously, there is plenty out there about MyISAM vs InnoDB engine selection, but I couldn't find anything specific to JPA2.
Is it possible to use a MyISAM engine together with java persistence API, and still have transaction support? Or does it rely on the RDBMS to provide rollback / commit functionality?
Are there other (non-obvious) factors that need to be considered? What about @Cascade
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现这篇文章,它为使用事务 RDBMS 后端提供了一个很好的案例。
我设法重现了该行为:
,使用 MyISAM 抛出异常,该实体将保持创建状态。使用 InnoDB,实体被创建,但随后回滚。因此,尽管我无法找到官方的东西,但我确信如果希望容器提供的事务能够正常工作,那么需要一个事务后端。
I found this posting, which makes a pretty good case for using transactional RDBMS backends.
I managed to reproduce the behaviour:
With MyISAM, the entity will remain created. With InnoDB, the entity is created, but then rolled back. So even though I haven't been able to find something official, I am convinced that a transactional backend is required if one expects container-provided transactions to work.