net.sf.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) for com.illumining.client.domain.impl.DiscussionMessageImpl instance with identifier: 21

Hibernate JIRA | Andy Peel | 1 decade ago
  1. 0

    Hibernate / Mailing Lists

    sourceforge.net | 5 months ago
    net.sf.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) for com.illumining.client.domain.impl.DiscussionMessageImpl instance with identifier: 21
  2. Speed up your debug routine!

    Automated exception search integrated into your IDE

  3. 0

    HIbernate StaleObject exception continuously on a thread

    Stack Overflow | 4 years ago | siddhesh jog
    net.sf.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) for com.cmp1.project1.hibernate.gen.Prjexe instance with identifier: 37120123
  4. 0

    I expected that hibernate would insert both parent and child using cascade operation. But it seems no insert but update SQL was issued for the Child entity since hibernate's log. This happens only when I define child's key as composite key entity instead of single ID. What's wrong? --- Client // open hibernate session ... Parent parent = new Parent(); Child child = new Child(); ChildKey key = new ChildKey(); HashSet set = new HashSet(); parent.setChildren(set); set.add(child); child.setChildKey(key); parent.setParentValue("test parent"); child.setChildValue("test child"); key.setChildKey1("test key1"); key.setChildKey2("test key2"); session.save(parent); session.flush(); // commit transaction and close hibernate session --- log Hibernate: select hibernate_sequence.nextval from dual Hibernate: insert into PARENT (verid, PARENT_VALUE, PARENT_ID) values (?, ?, ?) Hibernate: update CHILD set verid=?, CHILD_VALUE=? where CHILD_KEY1=? and CHILD_KEY2=? and verid=? net.sf.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) for entity.Child instance with identifier: entity.ChildKey@1dc0e7a[childKey1=test key1,childKey2=test key2] at net.sf.hibernate.persister.AbstractEntityPersister.check(AbstractEntityPersister.java:506) at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:687) at net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:642) at net.sf.hibernate.impl.ScheduledUpdate.execute(ScheduledUpdate.java:52) at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2418) at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2372) at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2240) at entity.Client.doInsert(Client.java:65) at entity.Client.main(Client.java:33) --- Parent.hbm.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"> <hibernate-mapping> <class name="entity.Parent" table="PARENT"> <id name="id" column="PARENT_ID" type="java.lang.Long"> <generator class="native"/> </id> <version name="verid" type="int" /> <property name="parentValue" type="string" > <column name="PARENT_VALUE" length="20" not-null="false"/> </property> <set name="children" cascade="all-delete-orphan" inverse="false" order-by="CHILD_KEY1, CHILD_KEY2"> <key column="PARENT_ID"/> <one-to-many class="entity.Child"/> </set> </class> </hibernate-mapping> --- Child.hbm.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"> <hibernate-mapping> <class name="entity.Child" table="CHILD"> <composite-id name="childKey" class="entity.ChildKey"> <key-property name="childKey1" type="string" > <column name="CHILD_KEY1" length="3" not-null="true"/> </key-property> <key-property name="childKey2" type="string"> <column name="CHILD_KEY2" length="3" not-null="true"/> </key-property> </composite-id> <version name="verid" type="int" /> <property name="childValue" type="string" > <column name="CHILD_VALUE" length="20" not-null="false"/> </property> </class> </hibernate-mapping>

    Hibernate JIRA | 1 decade ago | Takeshi SAKAKIBARA
    net.sf.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) for entity.Child instance with identifier: entity.ChildKey@1dc0e7a[childKey1=test key1,childKey2=test key2]

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. net.sf.hibernate.StaleObjectStateException

      Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) for com.illumining.client.domain.impl.DiscussionMessageImpl instance with identifier: 21

      at net.sf.hibernate.persister.AbstractEntityPersister.check()
    2. net.sf.hibernate
      SessionImpl.flush
      1. net.sf.hibernate.persister.AbstractEntityPersister.check(AbstractEntityPersister.java:501)
      2. net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:672)
      3. net.sf.hibernate.persister.EntityPersister.update(EntityPersister.java:642)
      4. net.sf.hibernate.impl.ScheduledUpdate.execute(ScheduledUpdate.java:52)
      5. net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2414)
      6. net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2368)
      7. net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2236)
      7 frames