Example usage for org.hibernate LockMode NONE

List of usage examples for org.hibernate LockMode NONE

Introduction

In this page you can find the example usage for org.hibernate LockMode NONE.

Prototype

LockMode NONE

To view the source code for org.hibernate LockMode NONE.

Click Source Link

Document

No lock required.

Usage

From source file:org.jbpm.pvm.internal.hibernate.DbSessionImpl.java

License:Open Source License

public ClientExecution findExecutionById(String executionId) {
    // query definition can be found at the bottom of resource jbpm.pvm.execution.hbm.xml
    Query query = session.getNamedQuery("findExecutionById");
    query.setString("id", executionId);
    query.setMaxResults(1);/*from  w  ww.j  a  v  a  2 s. c o  m*/
    //query.setLockMode("execution", LockMode.READ);
    query.setLockMode("execution", LockMode.NONE);
    return (ClientExecution) query.uniqueResult();
}

From source file:org.jbpm.pvm.internal.hibernate.DbSessionImpl.java

License:Open Source License

public ClientExecution findProcessInstanceById(String processInstanceId) {
    // query definition can be found at the bottom of resource jbpm.pvm.execution.hbm.xml
    Query query = session.getNamedQuery("findProcessInstanceById");
    query.setString("processInstanceId", processInstanceId);
    //query.setLockMode("processInstance", LockMode.READ);   
    query.setLockMode("processInstance", LockMode.NONE);
    query.setMaxResults(1);/*  w ww  .j a va2 s . c o  m*/
    return (ClientExecution) query.uniqueResult();
}

From source file:org.jbpm.pvm.internal.hibernate.DbSessionImpl.java

License:Open Source License

public ClientExecution findProcessInstanceByIdIgnoreSuspended(String processInstanceId) {
    // query definition can be found at the bottom of resource jbpm.pvm.execution.hbm.xml
    Query query = session.getNamedQuery("findProcessInstanceByIdIgnoreSuspended");
    query.setString("processInstanceId", processInstanceId);
    //query.setLockMode("processInstance", LockMode.READ);
    query.setLockMode("processInstance", LockMode.NONE);
    query.setMaxResults(1);/*from   w ww.j  ava2  s  .  com*/
    return (ClientExecution) query.uniqueResult();
}

From source file:org.jbpm.pvm.internal.hibernate.DbSessionImpl.java

License:Open Source License

public List<String> findProcessInstanceIds(String processDefinitionId) {
    // query definition can be found at the bottom of resource jbpm.pvm.job.hbm.xml
    Query query = session.createQuery(
            "select processInstance.id " + "from org.jbpm.pvm.internal.model.ExecutionImpl as processInstance "
                    + "where processInstance.processDefinitionId = :processDefinitionId "
                    + "  and processInstance.parent is null");
    query.setString("processDefinitionId", processDefinitionId);
    //query.setLockMode("processInstance", LockMode.READ);
    query.setLockMode("processInstance", LockMode.NONE);
    return query.list();
}

From source file:org.jbpm.pvm.internal.hibernate.DbSessionImpl.java

License:Open Source License

List<TaskImpl> findTasks(String processInstanceId) {
    Query query = session.createQuery("select task " + "from " + TaskImpl.class.getName() + " as task "
            + "where task.processInstance.id = :processInstanceId");
    //query.setLockMode("task", LockMode.READ);
    query.setLockMode("task", LockMode.NONE);
    query.setString("processInstanceId", processInstanceId);
    return query.list();
}

From source file:org.jbpm.pvm.internal.hibernate.DbSessionImpl.java

License:Open Source License

List<JobImpl> findJobs(String processInstanceId) {
    Query query = session.createQuery("select job " + "from " + JobImpl.class.getName() + " as job "
            + "where job.processInstance.id = :processInstanceId");
    query.setString("processInstanceId", processInstanceId);
    //query.setLockMode("job", LockMode.READ);
    query.setLockMode("job", LockMode.NONE);
    return query.list();
}

From source file:org.jbpm.pvm.internal.hibernate.DbSessionImpl.java

License:Open Source License

public void cascadeExecutionSuspend(ExecutionImpl execution) {
    // cascade suspend to jobs
    Query query = session.createQuery("select job " + "from " + JobImpl.class.getName() + " as job "
            + "where job.execution = :execution " + "  and job.state != '" + JobImpl.STATE_SUSPENDED + "' ");
    query.setEntity("execution", execution);
    query.setLockMode("job", LockMode.NONE);

    List<JobImpl> jobs = query.list();
    for (JobImpl job : jobs) {
        job.suspend();/* w  ww  .ja  v  a  2  s.  c  o m*/
    }

    // cascade suspend to tasks
    query = session.createQuery("select task " + "from " + TaskImpl.class.getName() + " as task "
            + "where task.execution = :execution " + "  and task.state != '" + Task.STATE_SUSPENDED + "' ");
    query.setEntity("execution", execution);
    query.setLockMode("task", LockMode.NONE);

    List<TaskImpl> tasks = query.list();
    for (TaskImpl task : tasks) {
        task.suspend();
    }
}

From source file:org.jbpm.pvm.internal.hibernate.DbSessionImpl.java

License:Open Source License

public void cascadeExecutionResume(ExecutionImpl execution) {
    // cascade suspend to jobs
    Query query = session.createQuery("select job " + "from " + JobImpl.class.getName() + " as job "
            + "where job.execution = :execution " + "  and job.state = '" + Task.STATE_SUSPENDED + "' ");
    query.setEntity("execution", execution);
    query.setLockMode("job", LockMode.NONE);

    List<JobImpl> jobs = query.list();
    for (JobImpl job : jobs) {
        job.resume();/*from  ww w . j  av a2  s.  c  om*/
    }

    // cascade suspend to tasks
    query = session.createQuery("select task " + "from " + TaskImpl.class.getName() + " as task "
            + "where task.execution = :execution " + "  and task.state = '" + Task.STATE_SUSPENDED + "' ");
    query.setEntity("execution", execution);
    query.setLockMode("task", LockMode.NONE);

    List<TaskImpl> tasks = query.list();
    for (TaskImpl task : tasks) {
        task.resume();
    }
}

From source file:org.jbpm.pvm.internal.hibernate.DbSessionImpl.java

License:Open Source License

public TaskImpl findTaskByExecution(Execution execution) {
    Query query = session.createQuery("select task " + "from " + TaskImpl.class.getName() + " as task "
            + "where task.execution = :execution");
    query.setEntity("execution", execution);
    query.setLockMode("task", LockMode.NONE);

    return (TaskImpl) query.uniqueResult();
}

From source file:org.jbpm.pvm.internal.hibernate.DbSessionImpl.java

License:Open Source License

public JobImpl<?> findFirstAcquirableJob() {
    Query query = session.getNamedQuery("findFirstAcquirableJob");
    query.setTimestamp("now", Clock.getCurrentTime());
    query.setMaxResults(1);/*from  w w  w . j  a  va 2  s  .c o  m*/
    //query.setLockMode("job", LockMode.READ);
    query.setLockMode("job", LockMode.NONE);
    return (JobImpl<?>) query.uniqueResult();
}