public Horario selectById(long id){
		Horario horario = new Horario(null, null);
		try {
			connection = Conexao.getInstance().obterConexao();
			connection.setAutoCommit(false);
			statement = connection.createStatement();
	 
			resultSet = statement.executeQuery("SELECT * FROM TB_HORARIO WHERE ID = " + id);
			resultSet.next();
			horario.setId(resultSet.getLong("id"));
			horario.setAviao(aviaoDAO.selectById(resultSet.getLong("id_aviao")));
			horario.setVoo(vooDAO.selectById(resultSet.getLong("id_voo")));
			horario.setDataPartida(resultSet.getDate("data_partida"));
			horario.setDataChegada(resultSet.getDate("data_chegada"));
			horario.setCodigo(resultSet.getString("codigo"));
			horario.setQtdEconomica(resultSet.getInt("qtd_economica"));
			horario.setQtdPrimeira(resultSet.getInt("qtd_primeira"));
			horario.setQtdExecutiva(resultSet.getInt("qtd_executiva"));
	 
		} catch (Exception e) {
			// TODO: handle exception
			try {
				if (connection != null && !connection.isClosed()) {
					connection.rollback();
				}
			} catch (SQLException e2) {
				// TODO: handle exception
				e2.printStackTrace();
			} finally{
				try {
					if (resultSet != null) {
						resultSet.close();
					}
					if (statement != null) {
						statement.close();
					}
					if (connection != null) {
						connection.close();
					}
				} catch (Exception e3) {
					// TODO: handle exception
				}
			}
		}
	 
		
		return horario;
	 
	}