@Override
 public List<UnderReplicatedBlock> findAll() throws StorageException {
   HopsSession session = connector.obtainSession();
   HopsQueryBuilder qb = session.getQueryBuilder();
   HopsQueryDomainType<UnderReplicatedBlocksDTO> dobj =
       qb.createQueryDefinition(UnderReplicatedBlocksDTO.class);
   HopsQuery<UnderReplicatedBlocksDTO> query = session.createQuery(dobj);
   query.setOrdering(Query.Ordering.ASCENDING, "level", "timestamp");
   List<UnderReplicatedBlock> blocks = createUrBlockList(query.getResultList());
   return blocks;
 }
 @Override
 public List<UnderReplicatedBlock> findByINodeIds(int[] inodeIds) throws StorageException {
   HopsSession session = connector.obtainSession();
   HopsQueryBuilder qb = session.getQueryBuilder();
   HopsQueryDomainType<UnderReplicatedBlocksDTO> qdt =
       qb.createQueryDefinition(UnderReplicatedBlocksDTO.class);
   HopsPredicate pred1 = qdt.get("iNodeId").in(qdt.param("idParam"));
   qdt.where(pred1);
   HopsQuery<UnderReplicatedBlocksDTO> query = session.createQuery(qdt);
   query.setParameter("idParam", Ints.asList(inodeIds));
   return createUrBlockList(query.getResultList());
 }
 @Override
 public Map<String, SchedulerApplication> getAll() throws StorageException {
   HopsSession session = connector.obtainSession();
   HopsQueryBuilder qb = session.getQueryBuilder();
   HopsQueryDomainType<SchedulerApplicationDTO> dobj =
       qb.createQueryDefinition(SchedulerApplicationClusterJ.SchedulerApplicationDTO.class);
   HopsQuery<SchedulerApplicationDTO> query = session.createQuery(dobj);
   List<SchedulerApplicationClusterJ.SchedulerApplicationDTO> queryResults = query.getResultList();
   Map<String, SchedulerApplication> result = createApplicationIdMap(queryResults);
   session.release(queryResults);
   return result;
 }
 @Override
 public List<UnderReplicatedBlock> findByLevel(int level) throws StorageException {
   HopsSession session = connector.obtainSession();
   HopsQueryBuilder qb = session.getQueryBuilder();
   HopsQueryDomainType<UnderReplicatedBlocksDTO> dobj =
       qb.createQueryDefinition(UnderReplicatedBlocksDTO.class);
   HopsPredicate pred = dobj.get("level").equal(dobj.param("level"));
   dobj.where(pred);
   HopsQuery<UnderReplicatedBlocksDTO> query = session.createQuery(dobj);
   query.setParameter("level", level);
   query.setOrdering(Query.Ordering.ASCENDING, "level", "timestamp");
   return createUrBlockList(query.getResultList());
 }
  @Override
  public List<QuotaUpdate> findByInodeId(int inodeId) throws StorageException {
    HopsSession session = connector.obtainSession();
    HopsQueryBuilder qb = session.getQueryBuilder();
    HopsQueryDomainType<QuotaUpdateDTO> dobj = qb.createQueryDefinition(QuotaUpdateDTO.class);
    HopsPredicate pred1 = dobj.get("inodeId").equal(dobj.param(INODE_ID_PARAM));
    dobj.where(pred1);
    HopsQuery<QuotaUpdateDTO> query = session.createQuery(dobj);
    query.setParameter(INODE_ID_PARAM, inodeId);

    List<QuotaUpdateDTO> results = query.getResultList();
    return convertAndRelease(session, results);
  }
 @Override
 public List<UnderReplicatedBlock> findByINodeId(int inodeId) throws StorageException {
   HopsSession session = connector.obtainSession();
   HopsQueryBuilder qb = session.getQueryBuilder();
   HopsQueryDomainType<UnderReplicatedBlocksDTO> qdt =
       qb.createQueryDefinition(UnderReplicatedBlocksDTO.class);
   HopsPredicate pred1 = qdt.get("iNodeId").equal(qdt.param("idParam"));
   qdt.where(pred1);
   HopsQuery<UnderReplicatedBlocksDTO> query = session.createQuery(qdt);
   query.setParameter("idParam", inodeId);
   // FIXME[M]: it throws ClusterJUserException: There is no index containing the ordering fields.
   // http://bugs.mysql.com/bug.php?id=67765
   // query.setOrdering(HopsQuery.Ordering.ASCENDING, "level", "timestamp");
   return createUrBlockList(query.getResultList());
 }
  @Override
  public Map<YarnRunningPrice.PriceType, YarnRunningPrice> getAll() throws StorageException {
    LOG.debug("HOP :: ClusterJ YarnRunningPrice.getAll - START");
    HopsSession session = connector.obtainSession();
    HopsQueryBuilder qb = session.getQueryBuilder();

    HopsQueryDomainType<YarnRunningPriceClusterJ.YarnRunningPriceDTO> dobj =
        qb.createQueryDefinition(YarnRunningPriceClusterJ.YarnRunningPriceDTO.class);
    HopsQuery<YarnRunningPriceClusterJ.YarnRunningPriceDTO> query = session.createQuery(dobj);

    List<YarnRunningPriceClusterJ.YarnRunningPriceDTO> queryResults = query.getResultList();
    LOG.debug("HOP :: ClusterJ YarnRunningPrice.getAll - STOP");
    Map<YarnRunningPrice.PriceType, YarnRunningPrice> result = createMap(queryResults);
    session.release(queryResults);
    return result;
  }