Thanks
I've moved forward: and now getting an other exception:
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [x.x.x.ProdoFeature#x.x.x.ProdoFeature@a6a76e4e]
I got that, when i want to set the Set after delete:
for(Iterator iter =prodo.getFeatures().iterator();iter.hasNext();actionSession.delete(iter.next()));
actionSession.save(prodo);
actionSession.refresh(prodo);
Object[] featureData;
for (int i = 0; i < fcs.length; i++) {
featureData = (Object[]) fcs[i];
ProdoFeature feature;
feature = (ProdoFeature) actionSession.createCriteria(
ProdoFeature.class).add(
Expression.eq("code", featureData[0])).add(
Expression.eq("prodo", prodo)).uniqueResult();
if (feature == null) {
feature = new ProdoFeature(featureData[0].toString(), prodo, ((Short) featureData[1]).shortValue());
}
else{
feature.setQuantity(((Short) featureData[1]).shortValue());
}
actionSession.saveOrUpdate(feature);
}
|