- int id = super.insert();
- GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("INSERT INTO organisations SET id=?, name=?, state=?, province=?, city=?, contactEmail=?, creator=?");
- ps.setInt(1, id);
- ps.setString(2, name);
- ps.setString(3, state);
- ps.setString(4, province);
- ps.setString(5, city);
- ps.setString(6, email);
- ps.setInt(7, creator.getId());
- synchronized (Organisation.class) {
- ps.execute();
+ this.optionalName = optionalName;
+ this.postalAddress = postalAddress;
+ int id = getId();
+ try (GigiPreparedStatement ps = new GigiPreparedStatement("INSERT INTO organisations SET id=?, name=?, state=?, province=?, city=?, contactEmail=?, optional_name=?, postal_address=?, creator=?")) {
+ ps.setInt(1, id);
+ ps.setString(2, name);
+ ps.setString(3, state);
+ ps.setString(4, province);
+ ps.setString(5, city);
+ ps.setString(6, email);
+ ps.setString(7, optionalName);
+ ps.setString(8, postalAddress);
+ ps.setInt(9, creator.getId());
+ synchronized (Organisation.class) {
+ ps.execute();
+ }