use of com.tomasio.projects.trainning.model.SolicitacaoPacesp in project trainning by fernandotomasio.
the class HibernateSolicitacaoPacespDAO method remove.
@Override
public void remove(Long id) throws DAOException {
Session session = sessionFactory.getCurrentSession();
SolicitacaoPacesp solicitacao = (SolicitacaoPacesp) session.get(SolicitacaoPacesp.class, id);
try {
session.delete(solicitacao);
} catch (HibernateException e) {
Logger.getLogger(HibernateTreinamentoSolicitadoDAO.class.getName()).log(Level.SEVERE, null, e);
throw new DAOException(MessageHelper.getMessage("solicitacoes.remove.error"));
}
}
use of com.tomasio.projects.trainning.model.SolicitacaoPacesp in project trainning by fernandotomasio.
the class HibernateSolicitacaoPacespDAO method create.
@Override
public Long create(SolicitacaoPacespDTO solicitacao) throws DAOException {
Session session = sessionFactory.getCurrentSession();
try {
SolicitacaoPacesp _solicitacao = new SolicitacaoPacesp(solicitacao);
Long solicitacaoId = (Long) session.save(_solicitacao);
return solicitacaoId;
} catch (HibernateException e) {
Logger.getLogger(TreinamentoSolicitadoDAO.class.getName()).log(Level.SEVERE, null, e);
throw new DAOException(MessageHelper.getMessage("solicitacoes.create.error"));
}
}
use of com.tomasio.projects.trainning.model.SolicitacaoPacesp in project trainning by fernandotomasio.
the class HibernateSolicitacaoPacespDAO method findAll.
@SuppressWarnings("unchecked")
@Override
public List<SolicitacaoPacespDTO> findAll(int ano, Long organizacaoProponenteId, Long organizacaoSolicitanteId) throws DAOException {
Session session = sessionFactory.getCurrentSession();
try {
Criteria criteria = session.createCriteria(SolicitacaoPacesp.class);
if (ano > 0) {
criteria.add(Restrictions.eq("ano", ano));
}
if (organizacaoProponenteId != null && organizacaoProponenteId > 0L) {
criteria.add(Restrictions.eq("organizacaoProponente.id", organizacaoProponenteId));
}
if (organizacaoSolicitanteId != null && organizacaoSolicitanteId > 0L) {
criteria.add(Restrictions.eq("organizacaoSolicitante.id", organizacaoSolicitanteId));
}
criteria.addOrder(Order.asc("organizacaoSolicitante.id"));
criteria.addOrder(Order.asc("prioridade"));
List<SolicitacaoPacesp> solicitacoes = criteria.list();
List<SolicitacaoPacespDTO> dto = new ArrayList<SolicitacaoPacespDTO>();
for (SolicitacaoPacesp solicitacao : solicitacoes) {
dto.add(solicitacao.createDTO());
}
return dto;
} catch (HibernateException e) {
Logger.getLogger(HibernateTreinamentoSolicitadoDAO.class.getName()).log(Level.SEVERE, null, e);
throw new DAOException(MessageHelper.getMessage("solicitacoes.find.list.error"));
}
}
use of com.tomasio.projects.trainning.model.SolicitacaoPacesp in project trainning by fernandotomasio.
the class HibernateSolicitacaoPacespDAO method update.
@Override
public void update(SolicitacaoPacespDTO solicitacao) throws DAOException {
Session session = sessionFactory.getCurrentSession();
SolicitacaoPacesp _solicitacao = new SolicitacaoPacesp(solicitacao);
try {
session.update(_solicitacao);
} catch (HibernateException e) {
Logger.getLogger(HibernateTreinamentoSolicitadoDAO.class.getName()).log(Level.SEVERE, null, e);
throw new DAOException(MessageHelper.getMessage("solicitacoes.update.error"));
}
}
Aggregations