@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 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()); }