1

I am trying to get data from the database by using code below. I am pretty sure that the query is correct but I always get this "DatabaseError: current transaction is aborted, commands ignored until end of transaction block". How can I fix it?

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()
4

1 回答 1

-1

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

于 2019-08-04T15:01:01.220 回答