Search in sources :

Example 6 with DAOFactory

use of com.tomasio.projects.trainning.dao.DAOFactory 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)

Example 7 with DAOFactory

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

the class AnotacaoTeste method main.

public static void main(String[] args) throws DAOException {
    DAOFactory factory = new DefaultDAOFactory();
    CursoDAO cursoDAO = factory.getCursoDAO();
    System.out.println(cursoDAO.findAll(null, null, null, null).size());
    System.out.println("ok");
}
Also used : DefaultDAOFactory(com.tomasio.projects.trainning.dao.DefaultDAOFactory) DefaultDAOFactory(com.tomasio.projects.trainning.dao.DefaultDAOFactory) DAOFactory(com.tomasio.projects.trainning.dao.DAOFactory) CursoDAO(com.tomasio.projects.trainning.dao.CursoDAO)

Aggregations

DAOFactory (com.tomasio.projects.trainning.dao.DAOFactory)7 CursoDAO (com.tomasio.projects.trainning.dao.CursoDAO)4 DAOException (com.tomasio.projects.trainning.exception.DAOException)4 ItemPlanejamentoDAO (com.tomasio.projects.trainning.dao.ItemPlanejamentoDAO)2 OrganizacaoDAO (com.tomasio.projects.trainning.dao.OrganizacaoDAO)2 ItemPlanejamentoDTO (com.tomasio.projects.trainning.dto.ItemPlanejamentoDTO)2 Curso (com.tomasio.projects.trainning.model.Curso)2 Organizacao (com.tomasio.projects.trainning.model.Organizacao)2 DefaultDAOFactory (com.tomasio.projects.trainning.dao.DefaultDAOFactory)1 NetworkGroupDAO (com.tomasio.projects.trainning.dao.NetworkGroupDAO)1 PlanejamentoDAO (com.tomasio.projects.trainning.dao.PlanejamentoDAO)1 PlanoDAO (com.tomasio.projects.trainning.dao.PlanoDAO)1 TreinamentoSolicitadoDAO (com.tomasio.projects.trainning.dao.TreinamentoSolicitadoDAO)1 CursoDTO (com.tomasio.projects.trainning.dto.CursoDTO)1 NetworkGroupDTO (com.tomasio.projects.trainning.dto.NetworkGroupDTO)1 PlanoDTO (com.tomasio.projects.trainning.dto.PlanoDTO)1 TreinamentoSolicitadoDTO (com.tomasio.projects.trainning.dto.TreinamentoSolicitadoDTO)1 ItemPlanejamento (com.tomasio.projects.trainning.model.ItemPlanejamento)1 Planejamento (com.tomasio.projects.trainning.model.Planejamento)1 TipoCurso (com.tomasio.projects.trainning.model.TipoCurso)1