/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package db.providers; import db.*; import db.entidades.Utilizador; import java.sql.ResultSet; import java.sql.Statement; /** * * @author lluis */ public class UtilizadoresDataProvider extends GenericDataProvider{ public Utilizador getUtilizador(Integer id) throws Exception { Utilizador u = new Utilizador(); Statement st = createStatement(); String sql = "SELECT * FROM utilizadores WHERE id = " + id; ResultSet rs = st.executeQuery(sql); rs.first(); u.setId(new Integer(rs.getInt("id"))); u.setLogin(rs.getString("login")); u.setPassword(rs.getString("password")); u.setData_password(rs.getDate("data_password")); u.setEmail(rs.getString("email")); u.setEmpresa_id(new Integer(rs.getInt("empresa_id"))); u.setEstabelecimento_id(new Integer(rs.getInt("estabelecimento_id"))); u.setAdministrador(rs.getString("administrador")); u.setTipo(new Integer(rs.getInt("tipo"))); u.setNumero_cedula(rs.getString("numero_cedula")); u.setCap(rs.getString("cap")); u.setNome(rs.getString("nome")); u.setMedico_id(new Integer(rs.getInt("medico_id"))); u.setFuncionario_hst_id(new Integer(rs.getInt("funcionario_hst_id"))); u.setActivo(rs.getString("activo")); u.setResponsavel_loja(rs.getString("responsavel_loja")); u.setGestor_geral(rs.getString("gestor_geral")); u.setApagado(rs.getString("apagado")); return u; } }