History | Log In     View a printable version of the current page. Get help!  
Issue Details (XML | Word)

Key: JBPM-478
Type: Bug Bug
Status: Resolved Resolved
Resolution: Out of Date
Priority: Major Major
Assignee: Tom Baeyens
Reporter: Aleksandr Tarutin
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
JBoss jBPM

Timers don't save when using ClassicQueryTranslatorFactory

Created: 22/Dec/05 09:45 PM   Updated: 16/Jun/08 08:37 AM
Component/s: Core Engine
Affects Version/s: jBPM 3.0.2
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown


 Description  « Hide
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);
      }
    }


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order:
Thomas Diesler [16/Jun/08 08:37 AM]
resolve as out of date because of 12 month no activity