Foto no postgre

seguinte tenho o motodo que cadastra uma foto


            public  void inserir(Cliente cli, File file) throws FileNotFoundException, IOException {
            
FileInputStream fis = new FileInputStream(file);
            
        String sql = "INSERT INTO cliente (nome_cliente, cpf_cliente, estado_cliente, data_cliente, nome_foto, foto_cliente) VALUES (?,?,?,?,?,?)";
        try {
            PreparedStatement stmt = getConexao().prepareStatement(sql);
         
            stmt.setString(1, cli.getNome_Cliente());
            stmt.setString(2, cli.getCpf_Cliente());
            stmt.setString(3, cli.getEstado_Cliente());
            stmt.setDate(4, new java.sql.Date(cli.getData_Cliente().getTime()));
            
            stmt.setString(5, file.getName());   
stmt.setBinaryStream(6, fis, (int)file.length());   
            
            stmt.executeUpdate();
            stmt.close();   
       fis.close();  
            
        } catch (SQLException sQLException) {
            System.out.println("Erro ao inserir Cliente." + sQLException.getMessage());
        }
        
    }

esta cadastrando certo porem nao consigo pegar devolta a imagem na consulta

tentei fazer o seguinte

   
  public List<Cliente> getCliente(ResultSet rs) throws SQLException {
        if(rs == null)
            return null;
        
        List<Cliente> lista = new ArrayList<Cliente>();
        while(rs.next()) {
            Cliente cli = new Cliente();
            cli.setid_Cliente(rs.getInt("id_cliente"));
            cli.setNome_Cliente(rs.getString("nome_cliente"));
            cli.setEstado_Cliente(rs.getString("estado_cliente"));
             cli.setfoto_cliente(rs.getBytes("foto_cliente"));
              cli.setnome_foto(rs.getSring("nome_foto"));
              
                             
              
            try {
                cli.setCpf_Cliente(rs.getString("cpf_cliente"));
            } catch (excessao ex) {}
            cli.setData_Cliente(new Date(rs.getDate("data_cliente").getTime()));
            lista.add(cli);
        }
        return lista;
    }


mas nao ta dando certo alguem teria alguma ideia ????????

vc n esta conseguindo fzer a foto q vc inseriu no banco ser exibida ?

isso mesmo quero exibir ela no netbeans tipo fazer uma consulta entendeu

com um select


 public List<Cliente> getCliente(ResultSet rs) throws SQLException {
        if(rs == null)
            return null;
        
        List<Cliente> lista = new ArrayList<Cliente>();
        while(rs.next()) {
            Cliente cli = new Cliente();
            cli.setid_Cliente(rs.getInt("id_cliente"));
            cli.setNome_Cliente(rs.getString("nome_cliente"));
            cli.setEstado_Cliente(rs.getString("estado_cliente"));     
             
            cli.setnome_foto(rs.getString("nome_foto"));
            
  cli.setFoto_Cliente(rs.getByte("foto_cliente"));//AQUI DA ERRO     nao pode ser aplicado para byte
             //Image img = Toolkit.getDefaultToolkit().createImage(rs.getBytes(0));  
            
            
            
            try {
                cli.setCpf_Cliente(rs.getString("cpf_cliente"));
            } catch (excessao ex) {}
            cli.setData_Cliente(new Date(rs.getDate("data_cliente").getTime()));
            lista.add(cli);
        }
        return lista;
    }

coloca a imagem junto com a lista entendeu

No caso, a foto foi armazenada como um array de bytes. Logo, deve ser recuperada com tal:

Image img = Toolkit.getDefaultToolkit().createImage(rs.getBytes("foto_cliente")); // recupera um array de bytes e cria uma images
cli.setFoto_Cliente(img); // muda a imagem

Pelo que pude entender, acho que é isso.

byte[] imgBytes = rs.getBytes("binaryfile");   
try{   
    FileOutputStream fos = new FileOutputStream("C:/imagens/"+ imagem.getFileName());   
     fos.write(imgBytes);   
     FileDescriptor fd = fos.getFD();   
     fos.flush();   
     fd.sync();   
     fos.close();   
}   

achei isso aqui que diz tirar do array de bit e colocar em um arquivo temporario para poder ser vizualizado mas nao consegio fazer funcionar