【发布时间】:2013-01-31 05:50:46
【问题描述】:
这个 JPQL
em.createQuery("INSERT INTO Count (id, count) SELECT 1, ?").setParameter(1, id).executeUpdate();
抛出
org.hibernate.hql.internal.ast.QuerySyntaxException: expecting OPEN, found ')' near line 1, column 29 [INSERT INTO Count (id, count) SELECT 1, ?]
查询应该是什么样子?
我使用 JPA API 但实际上使用 HQL 是否重要? JPQL 不支持INSERT。
在 JBoss AS 7.1.2 中使用 Hibernate 4.1.6。
参考:http://docs.jboss.org/hibernate/orm/4.1/devguide/en-US/html/ch11.html#d5e2637
【问题讨论】:
标签: java hibernate jpa insert jpql