JPA/Hibernate: Escaping HQL keywords

后端 未结 1 1406
情歌与酒
情歌与酒 2021-01-28 03:16

This is similar to How to escape reserved words in Hibernate's HQL. But I use JPA, so the solution isn\'t applicable.

So, how can I escape HQL keywords in JPA?

相关标签:
1条回答
  • 2021-01-28 03:54

    You could try something like this:

    em.createQuery("INSERT INTO Count c (c.id, c.count) SELECT 1, ?").setParameter(1, id).executeUpdate();
    

    That should make it clear to JPA that you mean properties, not keywords.

    0 讨论(0)
提交回复
热议问题