@Override public DrugGroup update(DrugGroup object) { boolean result = true; try { preparedStatement = connection.prepareStatement( "UPDATE DRUGGROUP SET " + "DrugGroupName = ? WHERE DrugGroupID = ?"); preparedStatement.setString(1, object.getDrugGroupName()); preparedStatement.setString(2, object.getDrugGroupID()); result = preparedStatement.execute(); } catch (SQLException e) { e.printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } return result ? object : null; }
@Override public DrugGroup save(DrugGroup object) { boolean result = true; try { preparedStatement = connection.prepareStatement( "INSERT INTO DRUGGROUP(DrugGroupID, DrugGroupName) VALUES(?,?)"); preparedStatement.setString(1, object.getDrugGroupID()); preparedStatement.setString(2, object.getDrugGroupName()); result = preparedStatement.execute(); } catch (SQLException e) { } return result ? object : null; }