code: @Override
      public int transfer(Long maxTaskId, long oldPartitionId, long newPartitionId) throws Exception {
          StringBuilder update = new StringBuilder(69)
                          .append("UPDATE Task SET PARTN=:p2 WHERE ");
          if (maxTaskId != null && maxTaskId != Long.MAX_VALUE)
              update.append("ID<=:i AND ");
          update.append("PARTN=:p1 AND STATES<").append(TaskState.ENDED.bit);
  
          final boolean trace = TraceComponent.isAnyTracingEnabled();
          if (trace && tc.isEntryEnabled())
              Tr.entry(this, tc, "transfer", "taskId>=" + maxTaskId, "partition:" + oldPartitionId + "-->" + newPartitionId, update);
  
          EntityManager em = getPersistenceServiceUnit().createEntityManager();
          try {
              Query query = em.createQuery(update.toString());
              query.setParameter("p2", newPartitionId);
              if (maxTaskId != null && maxTaskId != Long.MAX_VALUE)
                  query.setParameter("i", maxTaskId);
              query.setParameter("p1", oldPartitionId);
              int count = query.executeUpdate();
  
              if (trace && tc.isEntryEnabled())
                  Tr.exit(this, tc, "transfer", count);
              return count;
          } finally {
              em.close();
          }
      }
docs: {@inheritDoc}