SharePrice price = copyOfShare.getPrice(12,2004,11);
if (price != null) {
price.setPrice(new BigDecimal(99000));
}
SharePrice newSp = new SharePrice(31, 2006, 11, new BigDecimal(31000));
copyOfShare.addPrice(newSp);
try {
logger.log(BasicLevel.DEBUG, "share price updated");
pm.currentTransaction().begin();
Share attachedShare = (Share) pm.makePersistent((Object)copyOfShare);
pm.currentTransaction().commit();