List of usage examples for org.hibernate HibernateException HibernateException
public HibernateException(Throwable cause)
From source file:br.com.jrinstall.service.OrdemDeServicoService.java
@Override public Object Save(Object obj) throws HibernateException { ordemServico = (OrdemServico) obj;//from w w w . j a v a2 s . c om try { ordemServico = (OrdemServico) HibernateHelper.saveOrUpdate(ordemServico); } catch (HibernateException ex) { throw new HibernateException("Erro ao salvar Ordem de Servio: " + ex.getMessage()); } return ordemServico; }
From source file:br.com.jrinstall.service.OrdemDeServicoService.java
public OrdemServicoItem SaveItem(OrdemServicoItem item) throws HibernateException { try {// w w w. j a va 2 s . co m item = (OrdemServicoItem) HibernateHelper.saveOrUpdate(item); } catch (HibernateException ex) { throw new HibernateException("Erro ao salvar Ordem de Servio: " + ex.getMessage()); } return item; }
From source file:br.com.jrinstall.service.OrdemDeServicoService.java
@Override public Boolean delete(Object obj) throws HibernateException { try {/* ww w . j av a 2 s. c o m*/ return HibernateHelper.delete(obj); } catch (HibernateException ex) { throw new HibernateException("Erro ao excluir: " + ex.getMessage()); } }
From source file:br.com.jrinstall.service.OrdemDeServicoService.java
@Override public List<Object> getListByHQL(String hql) throws HibernateException { List lista = new ArrayList(); try {//w w w . jav a 2s .com lista = HibernateHelper.execHQL(hql); } catch (HibernateException ex) { throw new HibernateException("Erro ao consulta o Ordem de servio."); } return lista; }
From source file:br.com.jrinstall.service.OrdemDeServicoService.java
@Override public Object getById(Integer id) { ordemServico = new OrdemServico(); try {// w ww . ja v a2 s . co m ordemServico = (OrdemServico) HibernateHelper.getById(OrdemServico.class, id); } catch (HibernateException ex) { throw new HibernateException("Erro ao consulta o Ordem de Servio."); } return ordemServico; }
From source file:br.com.jrinstall.service.TipoDeServicoService.java
@Override public Object Save(Object obj) throws HibernateException { tipoDeServico = (TipoServico) obj;//from w ww . j a v a 2 s. c om try { tipoDeServico = (TipoServico) HibernateHelper.saveOrUpdate(tipoDeServico); } catch (HibernateException ex) { throw new HibernateException("Erro ao salvar TipoServico: " + ex.getMessage()); } return tipoDeServico; }
From source file:br.com.jrinstall.service.TipoDeServicoService.java
@Override public List<Object> getListByHQL(String hql) throws HibernateException { List materiais = new ArrayList(); try {/* w w w.j av a2s . c om*/ materiais = HibernateHelper.execHQL(hql); } catch (HibernateException ex) { throw new HibernateException("Erro ao consulta o TipoServico."); } return materiais; }
From source file:br.com.jrinstall.service.TipoDeServicoService.java
@Override public Object getById(Integer id) throws HibernateException { tipoDeServico = new TipoServico(); try {/*from w w w . j a v a 2 s.c o m*/ tipoDeServico = (TipoServico) HibernateHelper.getById(TipoServico.class, id); } catch (HibernateException ex) { throw new HibernateException("Erro ao consulta o TipoServico."); } return tipoDeServico; }
From source file:br.com.thiaguten.persistence.spi.provider.hibernate.HibernatePersistenceProvider.java
License:Apache License
private <ID extends Serializable, T extends Persistable<ID>> void deleteByEntityOrId(Class<T> entityClazz, T entity, ID id) {/*from w w w .j av a 2 s .com*/ if (id == null && (entity == null || entity.getId() == null)) { throw new HibernateException("Could not delete. ID is null."); } ID _id = id; if (_id == null) { _id = entity.getId(); } T t = (T) getSession().load(entityClazz, _id); getSession().delete(t); }
From source file:br.eb.ime.pfc.hibernate.HibernateUtil.java
License:Open Source License
public static SessionFactory getSessionFactory() throws HibernateException { if (sessionFactory != null) { return sessionFactory; } else {//w ww .j a v a2s. co m throw new HibernateException("Could not initialize Hibernate."); } }