List of usage examples for org.hibernate SQLQuery uniqueResult
R uniqueResult();
From source file:org.generationcp.middleware.dao.gdms.AlleleValuesDAO.java
License:Open Source License
public long countCharAlleleValuesForPolymorphicMarkersRetrieval(List<Integer> gids) throws MiddlewareQueryException { try {/*ww w. ja va 2s . c o m*/ if (gids != null && !gids.isEmpty()) { SQLQuery query = this.getSession().createSQLQuery( AlleleValuesDAO.COUNT_CHAR_ALLELE_VALUES_FOR_POLYMORPHIC_MARKERS_RETRIEVAL_BY_GIDS); query.setParameterList("gids", gids); BigInteger result = (BigInteger) query.uniqueResult(); if (result != null) { return result.longValue(); } } } catch (HibernateException e) { this.logAndThrowException("Error with countCharAlleleValuesForPolymorphicMarkersRetrieval(gids=" + gids + ") query from AlleleValues: " + e.getMessage(), e); } return 0; }
From source file:org.generationcp.middleware.dao.gdms.AlleleValuesDAO.java
License:Open Source License
public long countMappingAlleleValuesForPolymorphicMarkersRetrieval(List<Integer> gids) throws MiddlewareQueryException { try {/*from w ww. j av a 2 s . c om*/ if (gids != null && !gids.isEmpty()) { SQLQuery query = this.getSession().createSQLQuery( AlleleValuesDAO.COUNT_MAPPING_ALLELE_VALUES_FOR_POLYMORPHIC_MARKERS_RETRIEVAL_BY_GIDS); query.setParameterList("gids", gids); BigInteger result = (BigInteger) query.uniqueResult(); if (result != null) { return result.longValue(); } } } catch (HibernateException e) { this.logAndThrowException("Error with countMappingAlleleValuesForPolymorphicMarkersRetrieval(gids=" + gids + ") query from AlleleValues: " + e.getMessage(), e); } return 0; }
From source file:org.generationcp.middleware.dao.gdms.AlleleValuesDAO.java
License:Open Source License
public long countByGids(List<Integer> gIds) throws MiddlewareQueryException { try {//from w ww . j a v a2s. c o m if (gIds != null && gIds.get(0) != null) { SQLQuery query = this.getSession().createSQLQuery(AlleleValuesDAO.COUNT_BY_GIDS); query.setParameterList("gIdList", gIds); BigInteger result = (BigInteger) query.uniqueResult(); if (result != null) { return result.longValue(); } } } catch (HibernateException e) { this.logAndThrowException( "Error with countByGids(gIds=" + gIds + ") query from AlleleValuesDAO: " + e.getMessage(), e); } return 0; }
From source file:org.generationcp.middleware.dao.gdms.CharValuesDAO.java
License:Open Source License
public long countGIDsByMarkerId(final Integer markerId) { try {/*from w w w .ja v a 2 s .co m*/ if (markerId != null) { SQLQuery query = this.getSession().createSQLQuery(CharValuesDAO.COUNT_GIDS_BY_MARKER_ID); query.setParameter("markerId", markerId); BigInteger result = (BigInteger) query.uniqueResult(); if (result != null) { return result.longValue(); } } } catch (HibernateException e) { throw new MiddlewareQueryException("Error with countGIDsByMarkerId(markerId=" + markerId + ") query from CharValues: " + e.getMessage(), e); } return 0; }
From source file:org.generationcp.middleware.dao.gdms.MapDAO.java
License:Open Source License
public Long countMapDetailsByName(final String nameLike) { final SQLQuery query = this.getSession().createSQLQuery(MapDAO.COUNT_MAP_DETAILS_BY_NAME); query.setString("nameLike", nameLike.toLowerCase()); try {//from w w w . ja v a2 s . c o m final BigInteger result = (BigInteger) query.uniqueResult(); return result.longValue(); } catch (final HibernateException e) { MapDAO.LOG.error(e.getMessage(), e); throw new MiddlewareQueryException("Error with countMapDetailsByName() query: " + e.getMessage(), e); } }
From source file:org.generationcp.middleware.dao.gdms.MapDAO.java
License:Open Source License
public long countAllMapDetails() { try {/* w w w. j a v a 2 s . c om*/ final SQLQuery query = this.getSession().createSQLQuery(MapDAO.COUNT_MAP_DETAILS); final BigInteger result = (BigInteger) query.uniqueResult(); if (result != null) { return result.longValue(); } return 0; } catch (final HibernateException e) { MapDAO.LOG.error(e.getMessage(), e); throw new MiddlewareQueryException("Error with countAllMapDetails() query: " + e.getMessage(), e); } }
From source file:org.generationcp.middleware.dao.gdms.MapDAO.java
License:Open Source License
public Integer getMapIdByName(final String mapName) { try {//w ww.ja va2 s. com final SQLQuery query = this.getSession().createSQLQuery(MapDAO.GET_MAP_ID_BY_NAME); query.setParameter("mapName", mapName); return (Integer) query.uniqueResult(); } catch (final HibernateException e) { MapDAO.LOG.error(e.getMessage(), e); throw new MiddlewareQueryException( "Error with getMapIdByName(" + mapName + ") in MapDAO: " + e.getMessage(), e); } }
From source file:org.generationcp.middleware.dao.gdms.MappingPopDAO.java
License:Open Source License
public Long countAllParentsFromMappingPopulation() throws MiddlewareQueryException { SQLQuery query = this.getSession().createSQLQuery(MappingPopDAO.COUNT_ALL_PARENTS_FROM_MAPPING_POPULATION); try {/*from ww w .j av a2 s . c o m*/ BigInteger result = (BigInteger) query.uniqueResult(); return result.longValue(); } catch (HibernateException e) { this.logAndThrowException( "Error with countAllParentsFromMappingPopulation() query from MappingPop: " + e.getMessage(), e); } return 0L; }
From source file:org.generationcp.middleware.dao.gdms.MappingPopValuesDAO.java
License:Open Source License
/** * Count gids by marker id./*from w w w . j a v a 2 s. com*/ * * @param markerId the marker id * @return the long * @throws MiddlewareQueryException the MiddlewareQueryException */ public long countGIDsByMarkerId(Integer markerId) throws MiddlewareQueryException { try { if (markerId != null) { SQLQuery query = this.getSession().createSQLQuery(MappingPopValuesDAO.COUNT_GIDS_BY_MARKER_ID); query.setParameter("markerId", markerId); BigInteger result = (BigInteger) query.uniqueResult(); if (result != null) { return result.longValue(); } } } catch (HibernateException e) { this.logAndThrowException("Error with countGIDsByMarkerId(markerId=" + markerId + ") query from MappingPopValues: " + e.getMessage(), e); } return 0; }
From source file:org.generationcp.middleware.dao.gdms.MappingPopValuesDAO.java
License:Open Source License
public long countByGids(List<Integer> gIds) throws MiddlewareQueryException { try {//from ww w .j av a2 s . c o m if (gIds != null && gIds.get(0) != null) { SQLQuery query = this.getSession().createSQLQuery(MappingPopValuesDAO.COUNT_BY_GIDS); query.setParameterList("gIdList", gIds); BigInteger result = (BigInteger) query.uniqueResult(); if (result != null) { return result.longValue(); } } } catch (HibernateException e) { this.logAndThrowException( "Error with countByGids(gIds=" + gIds + ") query from MappingPopValues: " + e.getMessage(), e); } return 0; }