1.1 --- a/src/java/de/uapcore/lightpit/entities/ModuleDao.java Sun Apr 08 14:41:10 2018 +0200 1.2 +++ b/src/java/de/uapcore/lightpit/entities/ModuleDao.java Sun Apr 08 15:34:11 2018 +0200 1.3 @@ -43,6 +43,19 @@ 1.4 public abstract class ModuleDao { 1.5 1.6 /** 1.7 + * Maps database columns to POJO fields. 1.8 + * @param result the database result set 1.9 + * @param mod the POJO 1.10 + * @throws SQLException 1.11 + */ 1.12 + protected void mapColumns(ResultSet result, Module mod) throws SQLException { 1.13 + mod.setModID(result.getInt("modid")); 1.14 + mod.setClassname(result.getString("classname")); 1.15 + mod.setVisible(result.getBoolean("visible")); 1.16 + } 1.17 + 1.18 + 1.19 + /** 1.20 * Must return a prepared statement for a single object query with the specified properties. 1.21 * 1.22 * <ul> 1.23 @@ -136,9 +149,7 @@ 1.24 ResultSet result = stmt.executeQuery("SELECT * FROM lpitcore_module")) { 1.25 while (result.next()) { 1.26 final Module mod = new Module(); 1.27 - mod.setModID(result.getInt("modid")); 1.28 - mod.setClassname(result.getString("classname")); 1.29 - mod.setVisible(result.getBoolean("visible")); 1.30 + mapColumns(result, mod); 1.31 list.add(mod); 1.32 } 1.33 }