在JPA中,本机查询是否会发生回滚?

发布于 2024-08-31 19:16:32 字数 217 浏览 2 评论 0原文

我使用 JPA 1.0 和 hibernate 作为我的提供程序。在entitymanager事务内部,如果运行一系列本机查询(包括DELETE sql语句)并且发生错误,本机查询也会在错误时回滚吗?

我在 Oracle 数据库中遇到了死锁问题,我注意到即使某些事务已回滚,它也会使数据库不一致。我想知道不一致是否是由于一个事务成功但另一个事务回滚但仅回滚到某个点的事实造成的?

谢谢..

I'm using JPA 1.0 with hibernate as my provider. Inside an entitymanager transaction, if a series of native queries are run (which include DELETE sql statements) and an error occurs, will the native queries rollback too on the error?

I ran into a deadlock problem in an oracle database and I noticed that it left the database inconsistent even though some of the transaction was rolled back. I'm wondering if the inconsistency resulted from the fact that one transaction succeeded but the other transaction rolled back but only up to a certain point?

Thanks..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

倾`听者〃 2024-09-07 19:16:32

回滚不会具体回滚“JPQL 查询”,它会回滚 SQL 语句,这包括来自“本机查询”的 SQL 语句。

A rollback doesn't rollback "JPQL queries" specifically, it rollbacks SQL statements and this includes SQL statements from "native queries".

咆哮 2024-09-07 19:16:32

是的。发生错误时,JPQL 和本机 SQL 查询将回滚。

Yes. The JPQL and native SQL queries are rolled back when an error occurs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文