Commit 74b95d8ee7638d27cd6a4fa1802bad3a4eff457d

Authored by msahmane
1 parent 292aec6f

--no commit message

src/main/java/fr/plil/sio/persistence/jdbc/GroupRepositoryJdbc.java
... ... @@ -86,6 +86,27 @@ public class GroupRepositoryJdbc implements GroupRepository {
86 86  
87 87 @Override
88 88 public void delete(Long id) {
89   - throw new IllegalStateException("not implemented !");
  89 + Statement stmt = null;
  90 + ResultSet rs = null;
  91 + try {
  92 + stmt = dataSource.getConnection().createStatement();
  93 + stmt.execute("DELETE FROM GROUP_T WHERE GROUP_ID="+id,
  94 + Statement.RETURN_GENERATED_KEYS);
  95 + rs = stmt.getGeneratedKeys();
  96 +
  97 + } catch (SQLException e) {
  98 + throw new UnsupportedOperationException("sql exception", e);
  99 + } finally {
  100 + try {
  101 + if (rs != null) {
  102 + rs.close();
  103 + }
  104 + if (stmt != null) {
  105 + stmt.close();
  106 + }
  107 + } catch (SQLException e) {
  108 + throw new UnsupportedOperationException("sql exception during close", e);
  109 + }
  110 + }
90 111 }
91 112 }
... ...