public void save(){
        if(this.getId() != null){
            String q = "SELECT id, name " +
                    "FROM positions " +
                    "WHERE id = ?";
            try {
                PreparedStatement statement = Speciality.getConnection().prepareStatement(q,
                        ResultSet.TYPE_FORWARD_ONLY,
                        ResultSet.CONCUR_UPDATABLE);
                statement.setInt(1, this.getId());
                ResultSet resultSet = statement.executeQuery();
                if(resultSet.next()){
                    resultSet.updateString("name", this.getName());
                    resultSet.updateRow();
                }
            } catch (SQLException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            }
        } else {
            String q = "INSERT INTO positions (name) " +
                    "VALUES (?)";
            try {
                PreparedStatement statement = Speciality.getConnection().prepareStatement(q,
                        Statement.RETURN_GENERATED_KEYS);
                statement.setString(1, this.getName());
                statement.executeUpdate();
                ResultSet resultSet = statement.getGeneratedKeys();
                if(resultSet.next()){
                    this.setId(resultSet.getInt(1));
                }
            } catch (SQLException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            }
        }
    }