【发布时间】: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 的内容。似乎是关于特定框架的问题