Package org.hibernate

Examples of org.hibernate.Query.uniqueResult()


        .openSession();
    Payer payer = null;
    try {
      final Query query = session.createQuery(SELECT_PAYER_BY_EMAIL);
      query.setString(0, email);
      payer = (Payer) query.uniqueResult();
    } catch (final HibernateException e) {
      LOGGER.error(e);
    }
    return payer;
  }
View Full Code Here


  public Group retrieveGroup(final Long id) throws DataNotRetrievedException {
    final Session session = this.hibernateTemplate.getSessionFactory()
        .openSession();
    final Query query = session.createQuery(RETRIEVE_GROUP_BY_ID);
    query.setLong(0, id);
    final Group group = (Group) query.uniqueResult();
    return group;
  }

  @Override
  public void doDelete(final Group t) throws DataNotRemovedException {
View Full Code Here

    ProcessDefinition processDefinition = null;
    try {
      Query query = session.getNamedQuery("GraphSession.findProcessDefinitionByNameAndVersion");
      query.setString("name", name);
      query.setInteger("version", version);
      processDefinition = (ProcessDefinition) query.uniqueResult();
    } catch (Exception e) {
      e.printStackTrace(); log.error(e);
      jbpmSession.handleException();
      throw new JbpmException("couldn't get process definition with name '"+name+"' and version '"+version+"'", e);
    }
View Full Code Here

    ProcessDefinition processDefinition = null;
    try {
      Query query = session.getNamedQuery("GraphSession.findLatestProcessDefinitionQuery");
      query.setString("name", name);
      query.setMaxResults(1);
      processDefinition = (ProcessDefinition) query.uniqueResult();
    } catch (Exception e) {
     
      System.out.flush();
      System.err.flush();
      try {
View Full Code Here

    public int getMaxMessageIndex(Long logEntry) {  
        try {
            Query q = null;
            q = session.createQuery("select max(entry.index) from LogMessageEntry entry where entry.log=?");
            q.setLong(0, logEntry.longValue());
            return (Integer)q.uniqueResult();
            } catch(HibernateException he) {
                throw new DatabaseConnectionException(database, "Hibernate error on query", he);
            }
    }
   
View Full Code Here

        if (duration != null && queryString != null) {
            Query query = session.createSQLQuery(queryString);

            Long timeStamp;
            Object result = query.uniqueResult();
            if(result != null){
                String queryResult = query.uniqueResult().toString();
                Long timestamp = Long.parseLong(queryResult);
                aggregationSlice = dateTimeService.getTimeSlice(new DateTime(timestamp), duration).getMillis();
            }
View Full Code Here

            Query query = session.createSQLQuery(queryString);

            Long timeStamp;
            Object result = query.uniqueResult();
            if(result != null){
                String queryResult = query.uniqueResult().toString();
                Long timestamp = Long.parseLong(queryResult);
                aggregationSlice = dateTimeService.getTimeSlice(new DateTime(timestamp), duration).getMillis();
            }
        }
View Full Code Here

    public RoleEntity_2 findByName(String role)
    {
        Query q = getSession().createQuery("from RoleEntity where role=:varRole");
        q.setParameter("varRole", role);
        q.setCacheable(true);
        return (RoleEntity_2) q.uniqueResult();
    }

}
View Full Code Here

    public Setor consultarPorDescricao(String nomeSetor){
        Session session = HibernateUtil.getSessionFactory().openSession();
        session.beginTransaction();
        Query lista = session.createQuery("From Setor where nomeSetor = :descricao and codigoEmpresa=2");
        lista.setString("descricao", nomeSetor);
        Setor resultado = (Setor) lista.uniqueResult();
        session.getTransaction().commit();
        session.close();
        return resultado;
    }
}
View Full Code Here

        public Computador consultarPorDescricao(Computador computador){
        Session session = HibernateUtil.getSessionFactory().openSession();
        session.beginTransaction();
        Query lista = session.createQuery("From Computador where ds_plaqueta = :ds_plaqueta");
        lista.setInteger("ds_plaqueta", computador.getCodigoPlaqueta());
        Computador resultado = (Computador) lista.uniqueResult();
        session.close();
        return resultado;
    }
       
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.