code: public static DistributedSchedulingLock getDistributedScheduleByType(EntityManager em, long type) {
  		requireArgument(em != null, "Entity manager can not be null.");
  		
  		TypedQuery<DistributedSchedulingLock> query = em.createNamedQuery("DistributedSchedulingLock.GetEntryById", DistributedSchedulingLock.class);
  		query.setHint(QueryHints.REFRESH, HintValues.TRUE);
  		try {
  			query.setParameter("type", type);
  			return query.getSingleResult();
  		} catch (NoResultException ex) {
  			return null;
  		}
  	}
docs: Obtains a distributed schedule object of a given type.
  
  @param   em          The entity manager to use. Cannot be null.
  @param   type        The scheduling type represented as a long value.
  @return  The distributed schedule object of a given type.