List of usage examples for org.hibernate Query setLong
@Deprecated @SuppressWarnings("unchecked") default Query<R> setLong(String name, long val)
From source file:edu.depaul.armada.dao.ContainerDaoHibernate.java
License:Open Source License
/** * Returns a single Container object with a containerId field matching the one specified * as a parameter.//from w w w. j a v a 2 s .c o m * @param containerId long * @return Container */ @Override public Container findWithContainerId(long containerId) { AssertUtil.assertNotNull(containerId, "Parameter 'containerId' cannot be null!"); Query query = sessionFactory.getCurrentSession().createQuery("from Container where id = :containerId"); query.setLong("containerId", containerId); return (Container) query.uniqueResult(); }
From source file:edu.depaul.armada.dao.ContainerDaoHibernate.java
License:Open Source License
/** * Returns a List<DashboardContainer> of a limited number of DashboardContainers with a specific id. *///from w w w . jav a 2 s. co m @Override public List<DashboardContainer> getDashboardContainers(long id, int count) { Query query = sessionFactory.getCurrentSession().createQuery("from Container where id >= :id"); query.setLong("id", id); query.setMaxResults(count); List<Container> containers = query.list(); List<DashboardContainer> result = new ArrayList<DashboardContainer>(containers.size()); for (Container container : containers) { DashboardContainer temp = new DashboardContainer(); temp.name = container.getName(); temp.containerId = container.getId(); temp.containerUniqueId = container.getContainerUniqueId(); temp.cAdvisorURL = container.getCAdvisorURL(); List<ContainerLog> logs = container.getLogs(); ContainerLog[] logArr = logs.toArray(new ContainerLog[logs.size()]); int index = logArr.length - 1; temp.cpuUsed = logArr[index].getCpuUsed(); temp.cpuTotal = logArr[index].getCpuTotal(); temp.memUsed = logArr[index].getMemUsed(); temp.memTotal = logArr[index].getMemTotal(); temp.diskUsed = logArr[index].getDiskUsed(); temp.diskTotal = logArr[index].getDiskTotal(); result.add(temp); } return result; }
From source file:edu.monash.merc.dao.AccessionDAO.java
License:Open Source License
/** * {@inheritDoc}/* w w w .j a v a 2 s. com*/ */ public void deleteAccessionById(long id) { String del_hql = "DELETE FROM " + this.persistClass.getSimpleName() + " AS ac WHERE ac.id = :id"; Query query = this.session().createQuery(del_hql); query.setLong("id", id); query.executeUpdate(); }
From source file:edu.monash.merc.dao.AccessionTypeDAO.java
License:Open Source License
/** * {@inheritDoc}//w ww. j ava2s. c om */ public void deleteAccessionTypeById(long id) { String del_hql = "DELETE FROM " + this.persistClass.getSimpleName() + " AS act WHERE act.id = :id"; Query query = this.session().createQuery(del_hql); query.setLong("id", id); query.executeUpdate(); }
From source file:edu.monash.merc.dao.DBSourceDAO.java
License:Open Source License
/** * {@inheritDoc}/*w w w . j av a2s . c o m*/ */ public void deleteDBSourceById(long id) { String del_hql = "DELETE FROM " + this.persistClass.getSimpleName() + " AS dbs WHERE dbs.id = :id"; Query query = this.session().createQuery(del_hql); query.setLong("id", id); query.executeUpdate(); }
From source file:edu.monash.merc.dao.DSVersionDAO.java
License:Open Source License
/** * {@inheritDoc}//from w ww .j a va 2 s . co m */ public void deleteDsVersionById(long id) { String del_hql = "DELETE FROM " + this.persistClass.getSimpleName() + " AS dsv WHERE dsv.id = :id"; Query query = this.session().createQuery(del_hql); query.setLong("id", id); query.executeUpdate(); }
From source file:edu.monash.merc.dao.GeneDAO.java
License:Open Source License
/** * {@inheritDoc}// w ww . ja v a 2s.c o m */ public void deleteGeneById(long id) { String del_hql = "DELETE FROM " + this.persistClass.getSimpleName() + " AS g WHERE g.id = :id"; Query query = this.session().createQuery(del_hql); query.setLong("id", id); query.executeUpdate(); }
From source file:edu.monash.merc.dao.GeneDAO.java
License:Open Source License
/** * {@inheritDoc}//from w ww . ja va 2 s. c om */ @SuppressWarnings("unchecked") public List<Gene> getGenesByTLGeneId(long tlGeneId) { String sgQueryStr = "SELECT DISTINCT(g) FROM Gene g JOIN g.tlGenes tlgs WHERE tlgs.id = :tlGeneId"; Query sgQuery = this.session().createQuery(sgQueryStr); sgQuery.setLong("tlGeneId", tlGeneId); return sgQuery.list(); }
From source file:edu.monash.merc.dao.GeneDAO.java
License:Open Source License
/** * {@inheritDoc}/*from ww w . j a va2 s. c om*/ */ @SuppressWarnings("unchecked") public List<Accession> getAllAssociatedAccessionsByGeneId(long geneId) { String acQueryStr = "SELECT DISTINCT(gacs) FROM Gene g JOIN g.accessions gacs WHERE g.id = :geneId"; Query acQuery = this.session().createQuery(acQueryStr); acQuery.setLong("geneId", geneId); return acQuery.list(); }
From source file:edu.monash.merc.dao.NXAnnEvidenceDAO.java
License:Open Source License
/** * {@inheritDoc}//w w w. ja v a 2 s. c o m */ public void deleteNXAnnEvidenceById(long id) { String del_hql = "DELETE FROM " + this.persistClass.getSimpleName() + " AS nxAnnEv WHERE nxAnnEv.id = :id"; Query query = this.session().createQuery(del_hql); query.setLong("id", id); query.executeUpdate(); }