Example usage for org.hibernate HibernateException HibernateException

List of usage examples for org.hibernate HibernateException HibernateException

Introduction

In this page you can find the example usage for org.hibernate HibernateException HibernateException.

Prototype

public HibernateException(Throwable cause) 

Source Link

Document

Constructs a HibernateException using the given message and underlying cause.

Usage

From source file:br.com.jrinstall.service.BairroService.java

@Override
public Object Save(Object obj) throws HibernateException {

    bairro = (Bairro) obj;// www  .j  av  a 2 s . c o m

    try {

        bairro = (Bairro) HibernateHelper.saveOrUpdate(bairro);

    } catch (HibernateException ex) {
        throw new HibernateException("Erro ao salvar Bairro: " + ex.getMessage());
    }

    return bairro;
}

From source file:br.com.jrinstall.service.BairroService.java

@Override
public List<Object> getListByHQL(String hql) throws HibernateException {
    List bairros = new ArrayList();
    try {/* w ww  .  j av  a 2  s .c  o m*/
        bairros = HibernateHelper.execHQL(hql);
    } catch (HibernateException ex) {
        throw new HibernateException("Erro ao consulta o Bairro.");
    }
    return bairros;
}

From source file:br.com.jrinstall.service.BairroService.java

@Override
public Object getById(Integer id) throws HibernateException {
    bairro = new Bairro();
    try {// ww  w .  j  a va 2  s.  co  m
        bairro = (Bairro) HibernateHelper.getById(Bairro.class, id);
    } catch (HibernateException ex) {
        throw new HibernateException("Erro ao consulta o Bairro.");
    }
    return bairro;
}

From source file:br.com.jrinstall.service.CidadeService.java

@Override
public Object Save(Object obj) throws HibernateException {

    cidade = (Cidade) obj;// ww  w  .j  ava  2s. c  o m

    try {

        cidade = (Cidade) HibernateHelper.saveOrUpdate(cidade);

    } catch (HibernateException ex) {
        throw new HibernateException("Erro ao salvar Cidade: " + ex.getMessage());
    }

    return cidade;
}

From source file:br.com.jrinstall.service.CidadeService.java

@Override
public List<Object> getListByHQL(String hql) throws HibernateException {
    List clientes = new ArrayList();
    try {/*from www  . j  a v a  2  s .  c om*/
        clientes = HibernateHelper.execHQL(hql);
    } catch (HibernateException ex) {
        throw new HibernateException("Erro ao consulta o Cidade.");
    }
    return clientes;
}

From source file:br.com.jrinstall.service.CidadeService.java

public List<Object> getListByNamedQuery(String query) throws HibernateException {
    List clientes = new ArrayList();
    try {/*w  w  w  .  j  a v  a 2 s  . c  om*/
        clientes = HibernateHelper.execQuery(query);
    } catch (HibernateException ex) {
        throw new HibernateException("Erro ao consulta o Cidade.");
    }
    return clientes;
}

From source file:br.com.jrinstall.service.CidadeService.java

@Override
public Object getById(Integer id) throws HibernateException {
    cidade = new Cidade();
    try {/* w  w  w .j a  v a2  s  . com*/
        cidade = (Cidade) HibernateHelper.getById(Cidade.class, id);
    } catch (HibernateException ex) {
        throw new HibernateException("Erro ao consulta o Cidade.");
    }
    return cidade;
}

From source file:br.com.jrinstall.service.MaterialService.java

@Override
public Object Save(Object obj) throws HibernateException {

    material = (Material) obj;/*from   w  w w  . j  ava2s . co  m*/

    try {

        material = (Material) HibernateHelper.saveOrUpdate(material);

    } catch (HibernateException ex) {
        throw new HibernateException("Erro ao salvar Material: " + ex.getMessage());
    }

    return material;
}

From source file:br.com.jrinstall.service.MaterialService.java

@Override
public List<Object> getListByHQL(String hql) throws HibernateException {
    List materiais = new ArrayList();
    try {/*from w  w  w. j  a  va  2  s.  c  o m*/
        materiais = HibernateHelper.execHQL(hql);
    } catch (HibernateException ex) {
        throw new HibernateException("Erro ao consulta o Material.");
    }
    return materiais;
}

From source file:br.com.jrinstall.service.MaterialService.java

@Override
public Object getById(Integer id) throws HibernateException {
    material = new Material();
    try {/*  ww w  . j  a v  a 2 s . c  o  m*/
        material = (Material) HibernateHelper.getById(Material.class, id);
    } catch (HibernateException ex) {
        throw new HibernateException("Erro ao consulta o Material.");
    }
    return material;
}