[
http://jira.jboss.com/jira/browse/JBPM-478?page=all ]
Thomas Diesler resolved JBPM-478.
---------------------------------
Resolution: Out of Date
Timers don't save when using ClassicQueryTranslatorFactory
----------------------------------------------------------
Key: JBPM-478
URL:
http://jira.jboss.com/jira/browse/JBPM-478
Project: JBoss jBPM
Issue Type: Bug
Components: Core Engine
Affects Versions: jBPM 3.0.2
Reporter: Aleksandr Tarutin
Assigned To: Tom Baeyens
Unfortunately when using hibernate 3 with weblogic you have to use
hibernate.query.factory_class=org.hibernate.hql.classic.ClassicQueryTranslatorFactory to
configure hibernate because of antlr incompatibility between weblogic and hibernate.
That causes the delete timers queries in SchedulerSession to fail with the following
exception:
org.hibernate.QueryException: query must begin with SELECT or FROM: delete [delete from
org.jbpm.scheduler.exe.Timer where name = :timerName and token = :token]
I had to modify the source code to not use the batch DML for now only in two methods that
delete the timers. I'm going to modify the other code like that if we have the same
issues as we go.
The following is the code I use:
private static final String deleteTimersQuery =
"from org.jbpm.scheduler.exe.Timer t " +
"where t.name = :timerName" +
" and t.token = :token";
public void cancelTimers(SchedulerInstance.CancelledTimer cancelledTimer) {
try {
Query query = session.createQuery(deleteTimersQuery);
query.setString("timerName", cancelledTimer.getTimerName());
query.setEntity("token", cancelledTimer.getToken());
List timers = query.list();
for (Iterator ti = timers.iterator(); ti.hasNext();) {
Timer timer = (Timer) ti.next();
session.delete(timer);
}
} catch (Exception e) {
log.error(e);
jbpmSession.handleException();
throw new RuntimeException("couldn't delete timers
'"+cancelledTimer.getTimerName()+"' on token
'"+cancelledTimer.getToken().getId()+"' from the database", e);
}
}
private static final String deleteTimersForProcessInstanceQuery =
"from org.jbpm.scheduler.exe.Timer t " +
"where t.processInstance = :processInstance";
public void cancelTimersForProcessInstance(ProcessInstance processInstance) {
try {
Query query = session.createQuery(deleteTimersForProcessInstanceQuery);
query.setEntity("processInstance", processInstance);
List timers = query.list();
for (Iterator ti = timers.iterator(); ti.hasNext();) {
Timer timer = (Timer) ti.next();
session.delete(timer);
}
} catch (Exception e) {
log.error(e);
jbpmSession.handleException();
throw new RuntimeException("couldn't delete timers for process instance
'"+processInstance+"'", e);
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira