Search in sources :

Example 6 with Posto

use of com.tomasio.projects.trainning.model.Posto in project trainning by fernandotomasio.

the class OrganizationalServiceSimpleImpl method findAllPostos.

@Override
@Transactional(readOnly = true)
public PostoDTO[] findAllPostos() {
    PostoDAO dao = factory.getPostoDAO();
    PostoDTO[] postosArray = null;
    try {
        List<Posto> postos = dao.findAll();
        postosArray = new PostoDTO[postos.size()];
        for (int i = 0; i < postosArray.length; i++) {
            postosArray[i] = postos.get(i).createDTO();
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return postosArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) Posto(com.tomasio.projects.trainning.model.Posto) CoreException(com.tomasio.projects.trainning.exeption.CoreException) PostoDTO(com.tomasio.projects.trainning.dto.PostoDTO) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

DAOException (com.tomasio.projects.trainning.exception.DAOException)6 Posto (com.tomasio.projects.trainning.model.Posto)6 CoreException (com.tomasio.projects.trainning.exeption.CoreException)5 Transactional (org.springframework.transaction.annotation.Transactional)5 PostoDTO (com.tomasio.projects.trainning.dto.PostoDTO)1 HibernateException (org.hibernate.HibernateException)1 Session (org.hibernate.Session)1