This JPQL
em.createQuery("INSERT INTO Count (id, count) SELECT 1, ?").setParameter(1, id).executeUpdate();
throws
org.hibernate.hql.internal.ast.QuerySyntaxException: expecting OPEN, found ')' near line 1, column 29 [INSERT INTO Count (id, count) SELECT 1, ?]
How should the query look like?
Does it matter that I use JPA API but HQL actually? JPQL doesn’t support INSERT.
Using Hibernate 4.1.6 in JBoss AS 7.1.2.
Reference: http://docs.jboss.org/hibernate/orm/4.1/devguide/en-US/html/ch11.html#d5e2637
Since
countis a reserved word, adding square brackets around it like[count]will work.