public void delete(DomainObject obj, DomainObject assoc) throws SQLException { Connection connection = DbService.getConnection(); PreparedStatement stmt = null; try { stmt = connection.prepareStatement(deleteStatement()); stmt.setString(1, obj.getId()); stmt.setString(2, assoc.getId()); stmt.execute(); } finally { cleanUp(stmt); } }
public void insert(DomainObject obj, DomainObject assoc) throws SQLException { Connection connection = DbService.getConnection(); PreparedStatement stmt = null; try { stmt = connection.prepareStatement(insertStatement()); stmt.setString(1, obj.getId()); stmt.setString(2, assoc.getId()); stmt.execute(); // TODO cache!! // loaded.put(obj.getId(), obj); } finally { cleanUp(stmt); } }
public void delete(DomainObject obj, String sql) throws SQLException { if (obj == null) { return; } Connection connection = DbService.getConnection(); PreparedStatement stmt = null; try { stmt = connection.prepareStatement(sql); stmt.setString(1, obj.getId()); stmt.execute(); } finally { cleanUp(stmt); } }