I am using Spring 3, hibernate etc. I am trying to update a counter col in my table.. I do a select of the row, copy the data from the row to a new object and then try to do a saveOrUpdate with the new object and I get the following error:
My source code:
Code:public void updateSerialNumber(SerialNumber sn) { SerialNumber MySN = new SerialNumber(); log.debug("sn:" + sn.toString()); MySN.setName(sn.getName()); MySN.setValue(sn.getValue()); MySN.setSerialNumberId(sn.getSerialNumberId()); log.debug("MySN:" + MySN.toString()); sessionFactory.getCurrentSession().saveOrUpdate(MySN); }
My Error:
Code:2012-07-25 13:46:30,725 [http-8080-3] DEBUG org.springframework.web.servlet.DispatcherServlet - Could not complete request org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [org.uftwf.model.SerialNumber#CERT] at org.hibernate.engine.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:590)


Reply With Quote
