salve!
io ho questo metodo qua:
e uno praticamente identico per Editor.codice:public ArrayList<Author> getAuthor() throws SQLException, ClassNotFoundException { conn = DBManager.getInstance().takeConnection(); ArrayList<Author> list = new ArrayList<Author>(); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("SELECT * FROM author"); while (rs.next()) { Author author = new Author(); author.setAuthorId(rs.getInt("author_id")); author.setAuthorName(rs.getString("author_name")); list.add(author); } rs.close(); stmt.close(); return list; }
visto che poi li devo usare in più parti avevo pensato di generalizzarlo invece di avere codice praticamente uguale.
come posso fare?

Rispondi quotando