There seems to be a bug in bulk update/delete SQL generation in Hibernate 3.1. HQL statements that worked in 3.0 no longer work. The problem seems to be that in some cases HQL column names are not converted to SQL column names. This, among others, breaks JBPM.
Take this query for example (from JBPM's SchedulerSession.java):
Code:
private static final String deleteTimersQuery =
"delete from org.jbpm.scheduler.exe.Timer " +
"where name = :timerName" +
" and token = :token";
This generates the following SQL:
Code:
delete from JBPM_TIMER where NAME_=? and token=?
As you can see, "name" was converted correctly into "NAME_", while "token" was left as it was, instead of being coverted into "TOKEN_". This generates a "column does not exist" error.
Column name translation seems to work if you use aliases in HQL, like this (this is the above HQL rewritten):
Code:
delete from Timer [b]t[/b] where [b]t.[/b]name = :timerName and [b]t.[/b]token = :token
I already rewrote all of my HQL, but I don't want to rewrite JBPM as well, so we'll have to go back to 3.0 until this problem is fixed.
FYI: We're using PostgreSQL 8, maybe this bug is specific to its dialect.
Regards,
Jaka