I am getting the following error when I am trying to update some of my records.
org.hibernate.HibernateException: More than one row with the given identifier was found: 3333, for class: com.dao.hibernate.TaskItem
org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:135)
org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:81)
org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:2730)
org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:365)
org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:346)
org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:123)
org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:161)
org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:889)
org.hibernate.impl.SessionImpl.load(SessionImpl.java:808)
org.hibernate.impl.SessionImpl.load(SessionImpl.java:801)
com.accuserverx.accucharge.dao.hibernate.UpdateWorkListDAO.update(Unknown Source)
com.accuserverx.accucharge.web.UpdateWorkListAction.execute(Unknown Source)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
I am doing the update like this
Contact myContact = session.load(Contact.class, new Integer(6));
myContact.setFirstName("new name");
session.update(myContact);
session.flush();
session.clear();
|