1.1 --- a/src/main/java/de/uapcore/lightpit/dao/postgres/PGProjectDao.java Fri May 22 17:26:27 2020 +0200 1.2 +++ b/src/main/java/de/uapcore/lightpit/dao/postgres/PGProjectDao.java Fri May 22 21:23:57 2020 +0200 1.3 @@ -49,29 +49,29 @@ 1.4 1.5 public PGProjectDao(Connection connection) throws SQLException { 1.6 list = connection.prepareStatement( 1.7 - "select id, name, description, repourl, " + 1.8 + "select projectid, name, description, repourl, " + 1.9 "userid, username, lastname, givenname, mail " + 1.10 "from lpit_project " + 1.11 "left join lpit_user owner on lpit_project.owner = owner.userid " + 1.12 "order by name"); 1.13 1.14 find = connection.prepareStatement( 1.15 - "select id, name, description, repourl, " + 1.16 + "select projectid, name, description, repourl, " + 1.17 "userid, username, lastname, givenname, mail " + 1.18 "from lpit_project " + 1.19 "left join lpit_user owner on lpit_project.owner = owner.userid " + 1.20 - "where id = ?"); 1.21 + "where projectid = ?"); 1.22 1.23 insert = connection.prepareStatement( 1.24 "insert into lpit_project (name, description, repourl, owner) values (?, ?, ?, ?)" 1.25 ); 1.26 update = connection.prepareStatement( 1.27 - "update lpit_project set name = ?, description = ?, repourl = ?, owner = ? where id = ?" 1.28 + "update lpit_project set name = ?, description = ?, repourl = ?, owner = ? where projectid = ?" 1.29 ); 1.30 } 1.31 1.32 public Project mapColumns(ResultSet result) throws SQLException { 1.33 - final var proj = new Project(result.getInt("id")); 1.34 + final var proj = new Project(result.getInt("projectid")); 1.35 proj.setName(result.getString("name")); 1.36 proj.setDescription(result.getString("description")); 1.37 proj.setRepoUrl(result.getString("repourl")); 1.38 @@ -101,6 +101,7 @@ 1.39 1.40 @Override 1.41 public boolean update(Project instance) throws SQLException { 1.42 + if (instance.getId() < 0) return false; 1.43 Objects.requireNonNull(instance.getName()); 1.44 update.setString(1, instance.getName()); 1.45 setStringOrNull(update, 2, instance.getDescription());