Ticket #42 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

Hibernate exception when browsing logs

Reported by: jlowens@arl.army.mil Assigned to: eitan
Priority: major Component: persistence
Version: Keywords:
Cc:

Description

First application run (after adding a single model object) generates exceptions when trying to browse the log entries:

     [java] SEVERE: Could not synchronize database state with session
     [java] org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.u2d.type.composite.LoggedEvent#1]
     [java]     at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1635)
     [java]     at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2208)
     [java]     at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2118)
     [java]     at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2374)
     [java]     at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:91)
     [java]     at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
     [java]     at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
     [java]     at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
     [java]     at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
     [java]     at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41)
     [java]     at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:954)
     [java]     at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1526)
     [java]     at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
     [java]     at com.u2d.list.CriteriaListEO.fetchCurrentPage(CriteriaListEO.java:112)
     [java]     at com.u2d.list.CriteriaListEO.fetchPage(CriteriaListEO.java:131)
     [java]     at com.u2d.list.CriteriaListEO.setCriteria(CriteriaListEO.java:63)
     [java]     at com.u2d.list.CriteriaListEO.setQuery(CriteriaListEO.java:49)
     [java]     at com.u2d.list.CriteriaListEO.<init>(CriteriaListEO.java:39)
     [java]     at com.u2d.list.PagedList.<init>(PagedList.java:33)
     [java]     at com.u2d.persist.HBMSingleSession.browse(HBMSingleSession.java:408)
     [java]     at com.u2d.model.ComplexType.Browse(ComplexType.java:501)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [java]     at java.lang.reflect.Method.invoke(Method.java:585)
     [java]     at com.u2d.element.EOCommand.execute(EOCommand.java:84)
     [java]     at com.u2d.element.EOCommand.execute(EOCommand.java:69)
     [java]     at com.u2d.view.swing.CommandAdapter$1.run(CommandAdapter.java:58)
     [java] HibernateException ex: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.u2d.type.composite.LoggedEvent#1]
     [java] org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.u2d.type.composite.LoggedEvent#1]
     [java]     at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1635)
     [java]     at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2208)
     [java]     at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2118)
     [java]     at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2374)
     [java]     at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:91)
     [java]     at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
     [java]     at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
     [java]     at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
     [java]     at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
     [java]     at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41)
     [java]     at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:954)
     [java]     at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1526)
     [java]     at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
     [java]     at com.u2d.list.CriteriaListEO.fetchCurrentPage(CriteriaListEO.java:112)
     [java]     at com.u2d.list.CriteriaListEO.fetchPage(CriteriaListEO.java:131)
     [java]     at com.u2d.list.CriteriaListEO.setCriteria(CriteriaListEO.java:63)
     [java]     at com.u2d.list.CriteriaListEO.setQuery(CriteriaListEO.java:49)
     [java]     at com.u2d.list.CriteriaListEO.<init>(CriteriaListEO.java:39)
     [java]     at com.u2d.list.PagedList.<init>(PagedList.java:33)
     [java]     at com.u2d.persist.HBMSingleSession.browse(HBMSingleSession.java:408)
     [java]     at com.u2d.model.ComplexType.Browse(ComplexType.java:501)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [java]     at java.lang.reflect.Method.invoke(Method.java:585)
     [java]     at com.u2d.element.EOCommand.execute(EOCommand.java:84)
     [java]     at com.u2d.element.EOCommand.execute(EOCommand.java:69)
     [java]     at com.u2d.view.swing.CommandAdapter$1.run(CommandAdapter.java:58)

Change History

08/30/06 16:38:49 changed by jlowens@arl.army.mil

Using HSQLDB. I can also reproduce the problem under the Sympster example by updating the hibernate properties file, running ant schema-export, then ant run. Simply try to browse the log.

08/31/06 17:35:38 changed by eitan

can you reproduce the problem with mysql or postgres? just curious. it'd be nice to know if this is an hsqldb-specific issue..

thanks, eitan

09/03/06 02:23:46 changed by jlowens@arl.army.mil

I did not try postgres, but I can't reproduce the problem with MySQL, so it's probably HSQLDB related... I tried setting unsaved-value in the hbm generator - but it didn't make a difference. Hmmm, it'll obviously take a bit more investigation...

12/13/06 17:55:19 changed by eitan

  • component set to persistence.

02/01/07 13:27:14 changed by eitan

  • status changed from new to closed.
  • resolution set to fixed.

i have reproduced this bug and verified that:

replacing hiberante3.jar in the august release

with hibernatev3.2's hibernate3.jar fixes the problem (this requires having to revise one line in Application.java due to a change in the API (select count() now returns a Long instead of the original Integer).

this is already fixed in subversion.