Search in sources :

Example 11 with PlanoDAO

use of com.tomasio.projects.trainning.dao.PlanoDAO in project trainning by fernandotomasio.

the class ImportPlanosImpl method execute.

@Override
public void execute() {
    try {
        DAOFactory factory = DAOUtil.getDAOFactory();
        PlanoDAO dao = factory.getPlanoDAO();
        Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/dctp?user=root&password=123456");
        Statement stm = conn.createStatement();
        ResultSet rs = stm.executeQuery("SELECT * FROM plano");
        while (rs.next()) {
            String sigla = rs.getString("Plano");
            String descricao = rs.getString("Plano");
            PlanoDTO plano = new PlanoDTO();
            plano.setSigla(sigla);
            plano.setDescricao(descricao);
        // dao.create(plano);
        }
        conn.close();
    } catch (SQLException ex) {
        Logger.getLogger(ImportCursosImpl.class.getName()).log(Level.SEVERE, null, ex);
    }
// catch (DAOException ex) {
// Logger.getLogger(ImportCursosImpl.class.getName()).log(Level.SEVERE, null, ex);
// }
}
Also used : DAOFactory(com.tomasio.projects.trainning.dao.DAOFactory) PlanoDAO(com.tomasio.projects.trainning.dao.PlanoDAO) PlanoDTO(com.tomasio.projects.trainning.dto.PlanoDTO)

Aggregations

PlanoDAO (com.tomasio.projects.trainning.dao.PlanoDAO)11 Transactional (org.springframework.transaction.annotation.Transactional)10 Plano (com.tomasio.projects.trainning.model.Plano)8 PlanoDTO (com.tomasio.projects.trainning.dto.PlanoDTO)6 DAOException (com.tomasio.projects.trainning.exception.DAOException)6 CoreException (com.tomasio.projects.trainning.exeption.CoreException)6 ParseException (java.text.ParseException)2 DAOFactory (com.tomasio.projects.trainning.dao.DAOFactory)1 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1