【问题标题】:How to fix "current transaction is aborted commands ignored"如何修复“当前事务被中止命令被忽略”
【发布时间】:2019-12-12 04:41:43
【问题描述】:

我正在尝试使用以下代码从数据库中获取数据。我很确定查询是正确的,但我总是得到这个“数据库错误:当前事务被中止,命令被忽略直到事务块结束”。我该如何解决?

Transaction tx;
tx = persistence.getTransaction()
if (tx == null)
    tx = persistence.createTransaction()
def entityManager = persistence.getEntityManager()


dpArray = entityManager.createNativeQuery(dpSelectQuery, DeliveryPoint.class)
        .setParameter('contract', contract)
        .getResultList()
tx.end()

【问题讨论】:

  • 请提供完整的堆栈跟踪、发生错误的确切行、事务的完整类名。
  • 这里没有关于 sql 的内容。似乎是关于特定框架的问题

标签: sql groovy


【解决方案1】:

我找到了解决方案。我不能说这是什么原因,但我的查询返回空主键,直到我用“ID”替换所有“id”。 有一个关于它的话题: https://www.eclipse.org/forums/index.php/t/305321/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-01-13
    • 2013-08-04
    • 2012-05-11
    • 2014-11-15
    • 2016-12-11
    • 2011-12-06
    • 2013-10-25
    • 1970-01-01
    相关资源
    最近更新 更多