-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: update before delete
PostPosted: Thu Apr 27, 2006 6:18 am 
Newbie

Joined: Thu Apr 27, 2006 5:51 am
Posts: 5
Hi everybody,

we got the following problem: we have a parent-child-grandchild object graph. In a case without any grandchild, when we delete a child we get a stale object exception.
We traced this behaviour down to:
The DefaultDeleteEventListener.deleteEntity() generates a deletedState by usint TypeFactory.deepCopy, which does not copy the empty set, leaving the sets position in the deletedState null.
Upon flush the DefaultFlushEventListener.dirtyCheck method marks the entity as dirty, as null is obviously not an empty set. As this entity is now dirty our Interceptor is called (onFlushDirty) and sets a change timestamp and change user, which really makes our entity dirty.

Question:
is there a mistake in our mapping file?
or is it a bug in hibernate (generation of the deleted state?)
is there a fix for this behaviour?

Any help will be appreciated.
Thanx
Jochen

Hibernate version:
3.0.5

Mapping documents:
the child:
<class name="de.fhg.sigma.webzeb.pojo.ZewPos" table="ZEW_POS" select-before-update="true">
<id name="sysIsn" type="de.fhg.sigma.commons.type.SysIsnType">
<column name="SYS_ISN" />
<generator class="de.fhg.sigma.commons.persistence.SysIsnGenerator">
<param name="sequence">SYS_SEQUENCE</param>
</generator>
</id>
<version column="SYS_VERSION" name="sysVersion" type="java.lang.Long" />
<many-to-one name="zewKopf" class="de.fhg.sigma.webzeb.pojo.ZewKopf" fetch="select">
<column name="ISN_ZEW_KOPF" precision="38" scale="0" not-null="true" />
</many-to-one>
<many-to-one name="prKopf" class="de.fhg.sigma.webzeb.pojo.PrKopf" fetch="select">
<column name="ISN_PR_KOPF" precision="38" scale="0" not-null="false" />
</many-to-one>
<many-to-one name="osy103" class="de.fhg.sigma.webzeb.pojo.Osy103" fetch="select">
<column name="ISN_OSY103" precision="38" scale="0" not-null="false" />
</many-to-one>
<many-to-one name="osy809" class="de.fhg.sigma.webzeb.pojo.Osy809" fetch="select">
<column name="ISN_OSY809" precision="38" scale="0" not-null="false" />
</many-to-one>
<property name="sysMandant" type="java.lang.String">
<column name="SYS_MANDANT" length="3" not-null="true" />
</property>
<property name="sysFhi" type="de.fhg.sigma.commons.type.SysIsnType" >
<column name="SYS_FHI" precision="38" scale="0" not-null="true" />
</property>
<property name="isnMaGeaendert" type="de.fhg.sigma.commons.type.SysIsnType">
<column name="ISN_MA_GEAENDERT" precision="38" scale="0" not-null="true" />
</property>
<property name="datumGeaendert" type="java.util.Date">
<column name="DATUM_GEAENDERT" length="7" not-null="true" />
</property>
<property name="stunden" type="java.lang.Double">
<column name="STUNDEN" precision="4" scale="2"/>
</property>
<set name="zewPostags" inverse="true" lazy="false" cascade="all-delete-orphan" optimistic-lock="false">
<key>
<column name="ISN_ZEW_POS" precision="38" scale="0" not-null="true" />
</key>
<one-to-many class="de.fhg.sigma.webzeb.pojo.ZewPostag" />
</set>
</class>
the grandchild:
<class name="de.fhg.sigma.webzeb.pojo.ZewPostag" table="ZEW_POSTAG" select-before-update="true">
<id name="sysIsn" type="de.fhg.sigma.commons.type.SysIsnType">
<column name="SYS_ISN" />
<generator class="de.fhg.sigma.commons.persistence.SysIsnGenerator">
<param name="sequence">SYS_SEQUENCE</param>
</generator>
</id>
<many-to-one name="zewPos" class="de.fhg.sigma.webzeb.pojo.ZewPos" fetch="select">
<column name="ISN_ZEW_POS" precision="38" scale="0" not-null="true" />
</many-to-one>
<property name="sysMandant" type="java.lang.String">
<column name="SYS_MANDANT" length="3" not-null="true" />
</property>
<property name="sysFhi" type="de.fhg.sigma.commons.type.SysIsnType">
<column name="SYS_FHI" precision="38" scale="0" not-null="true" />
</property>
<property name="isnMaGeaendert" type="de.fhg.sigma.commons.type.SysIsnType">
<column name="ISN_MA_GEAENDERT" precision="38" scale="0" not-null="true" />
</property>
<property name="datumGeaendert" type="java.util.Date">
<column name="DATUM_GEAENDERT" length="7" not-null="true" />
</property>
<property name="stunden" type="java.lang.Double">
<column name="STUNDEN" precision="4" scale="2"/>
</property>
<property name="sysVersion" type="java.lang.Long">
<column name="SYS_VERSION" precision="9" scale="0" not-null="true" />
</property>
<property name="tag" type="java.lang.Integer">
<column name="TAG" precision="2" scale="0" />
</property>
</class>

Code between sessionFactory.openSession() and session.close():
Session hSession = SessionProvider.currentSession();
Transaction tx = hSession.beginTransaction();

for (Iterator iter = zewKopf.getZewPoses().iterator(); iter.hasNext();)
{
ZewPos zebPos = (ZewPos) iter.next();
if (zebPos.getSysIsn().equals(posSysIsn))
{
try
{
zewKopf.getZewPoses().remove(zebPos);
hSession.delete(zebPos);
tx.commit();
return zewKopf;
}
// Exception für konkurrierenden Zugriff
catch (StaleObjectStateException se)
{
tx.rollback();
throw (PersistenzException) PersistenzException.wrap(se);
}
catch (Exception e)
{
tx.rollback();
throw (PersistenzException) PersistenzException.wrap(e);
}
}
}
return zewKopf;

Full stack trace of any exception that occurs:
2006-04-27 11:43:55,665 [ main] ERROR AbstractFlushingEventListener - Could not synchronize database state with session
org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [de.fhg.sigma.webzeb.pojo.ZewPos#3406177704]
at org.hibernate.persister.entity.BasicEntityPersister.check(BasicEntityPersister.java:1441)
at org.hibernate.persister.entity.BasicEntityPersister.delete(BasicEntityPersister.java:2072)
at org.hibernate.persister.entity.BasicEntityPersister.delete(BasicEntityPersister.java:2213)
at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:59)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:324)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at de.fhg.sigma.webzeb.persistence.ZebDao.deleteZebPos(ZebDao.java:170)
at de.fhg.sigma.webzeb.usecasecontroller.ArbeitszeitManager.deleteZebPos(ArbeitszeitManager.java:255)
at de.fhg.sigma.webzeb.businessDelegate.ZebManagerBDImpl.deleteZebPosition(ZebManagerBDImpl.java:61)
at de.fhg.sigma.webzeb.businessDelegate.ZebManagerBDTest.testInsertZebPosWithProject(ZebManagerBDTest.java:152)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Name and version of the database you are using:
Oracle 9i

The generated SQL (show_sql=true):
see log below

Debug level Hibernate log excerpt:
2006-04-27 12:15:03,650 [ main] DEBUG DefaultDeleteEventListener - deleting a persistent instance
2006-04-27 12:15:03,665 [ main] DEBUG DefaultDeleteEventListener - deleting [de.fhg.sigma.webzeb.pojo.ZewPos#3406177704]
2006-04-27 12:15:03,665 [ main] DEBUG SessionImpl - setting cache mode to: GET
2006-04-27 12:15:03,665 [ main] DEBUG Cascades - processing cascade ACTION_DELETE for: de.fhg.sigma.webzeb.pojo.ZewPos
2006-04-27 12:15:03,665 [ main] DEBUG Cascades - cascade ACTION_DELETE for collection: de.fhg.sigma.webzeb.pojo.ZewPos.zewPostags
2006-04-27 12:15:03,665 [ main] DEBUG Cascades - done cascade ACTION_DELETE for collection: de.fhg.sigma.webzeb.pojo.ZewPos.zewPostags
2006-04-27 12:15:03,665 [ main] DEBUG Cascades - deleting orphans for collection: de.fhg.sigma.webzeb.pojo.ZewPos.zewPostags
2006-04-27 12:15:03,665 [ main] DEBUG Cascades - done deleting orphans for collection: de.fhg.sigma.webzeb.pojo.ZewPos.zewPostags
2006-04-27 12:15:03,665 [ main] DEBUG Cascades - done processing cascade ACTION_DELETE for: de.fhg.sigma.webzeb.pojo.ZewPos
2006-04-27 12:15:03,665 [ main] DEBUG SessionImpl - setting cache mode to: NORMAL
2006-04-27 12:15:03,665 [ main] DEBUG SessionImpl - setting cache mode to: GET
2006-04-27 12:15:03,665 [ main] DEBUG Cascades - processing cascade ACTION_DELETE for: de.fhg.sigma.webzeb.pojo.ZewPos
2006-04-27 12:15:03,665 [ main] DEBUG Cascades - done processing cascade ACTION_DELETE for: de.fhg.sigma.webzeb.pojo.ZewPos
2006-04-27 12:15:03,681 [ main] DEBUG SessionImpl - setting cache mode to: NORMAL
2006-04-27 12:15:03,681 [ main] DEBUG ZebDao - Zeb erfolgreich geloescht (3406177704).
2006-04-27 12:15:03,681 [ main] DEBUG JDBCTransaction - commit
2006-04-27 12:15:03,681 [ main] DEBUG SessionImpl - automatically flushing session
2006-04-27 12:15:03,681 [ main] DEBUG AbstractFlushingEventListener - flushing session
2006-04-27 12:15:03,681 [ main] DEBUG AbstractFlushingEventListener - processing flush-time cascades
2006-04-27 12:15:03,681 [ main] DEBUG Cascades - processing cascade ACTION_SAVE_UPDATE for: de.fhg.sigma.webzeb.pojo.ZewKopf
2006-04-27 12:15:03,681 [ main] DEBUG Cascades - cascade ACTION_SAVE_UPDATE for collection: de.fhg.sigma.webzeb.pojo.ZewKopf.zewPoses
2006-04-27 12:15:03,681 [ main] DEBUG Cascades - cascading to saveOrUpdate: de.fhg.sigma.webzeb.pojo.ZewPos
2006-04-27 12:15:03,681 [ main] DEBUG AbstractSaveEventListener - persistent instance of: de.fhg.sigma.webzeb.pojo.ZewPos
2006-04-27 12:15:03,681 [ main] DEBUG DefaultSaveOrUpdateEventListener - ignoring persistent instance
2006-04-27 12:15:03,681 [ main] DEBUG DefaultSaveOrUpdateEventListener - object already associated with session: [de.fhg.sigma.webzeb.pojo.ZewPos#3407188104]
2006-04-27 12:15:03,681 [ main] DEBUG Cascades - cascading to saveOrUpdate: de.fhg.sigma.webzeb.pojo.ZewPos
2006-04-27 12:15:03,681 [ main] DEBUG AbstractSaveEventListener - persistent instance of: de.fhg.sigma.webzeb.pojo.ZewPos
2006-04-27 12:15:03,681 [ main] DEBUG DefaultSaveOrUpdateEventListener - ignoring persistent instance
2006-04-27 12:15:03,681 [ main] DEBUG DefaultSaveOrUpdateEventListener - object already associated with session: [de.fhg.sigma.webzeb.pojo.ZewPos#3402162604]
2006-04-27 12:15:03,681 [ main] DEBUG Cascades - done cascade ACTION_SAVE_UPDATE for collection: de.fhg.sigma.webzeb.pojo.ZewKopf.zewPoses
2006-04-27 12:15:03,681 [ main] DEBUG Cascades - done processing cascade ACTION_SAVE_UPDATE for: de.fhg.sigma.webzeb.pojo.ZewKopf
2006-04-27 12:15:03,681 [ main] DEBUG Cascades - processing cascade ACTION_SAVE_UPDATE for: de.fhg.sigma.webzeb.pojo.ZewPos
2006-04-27 12:15:03,681 [ main] DEBUG Cascades - cascade ACTION_SAVE_UPDATE for collection: de.fhg.sigma.webzeb.pojo.ZewPos.zewPostags
2006-04-27 12:15:03,681 [ main] DEBUG Cascades - done cascade ACTION_SAVE_UPDATE for collection: de.fhg.sigma.webzeb.pojo.ZewPos.zewPostags
2006-04-27 12:15:03,681 [ main] DEBUG Cascades - deleting orphans for collection: de.fhg.sigma.webzeb.pojo.ZewPos.zewPostags
2006-04-27 12:15:03,681 [ main] DEBUG Cascades - done deleting orphans for collection: de.fhg.sigma.webzeb.pojo.ZewPos.zewPostags
2006-04-27 12:15:03,681 [ main] DEBUG Cascades - done processing cascade ACTION_SAVE_UPDATE for: de.fhg.sigma.webzeb.pojo.ZewPos
2006-04-27 12:15:03,681 [ main] DEBUG Cascades - processing cascade ACTION_SAVE_UPDATE for: de.fhg.sigma.webzeb.pojo.ZewPos
2006-04-27 12:15:03,681 [ main] DEBUG Cascades - cascade ACTION_SAVE_UPDATE for collection: de.fhg.sigma.webzeb.pojo.ZewPos.zewPostags
2006-04-27 12:15:03,681 [ main] DEBUG Cascades - cascading to saveOrUpdate: de.fhg.sigma.webzeb.pojo.ZewPostag
2006-04-27 12:15:03,681 [ main] DEBUG AbstractSaveEventListener - persistent instance of: de.fhg.sigma.webzeb.pojo.ZewPostag
2006-04-27 12:15:03,681 [ main] DEBUG DefaultSaveOrUpdateEventListener - ignoring persistent instance
2006-04-27 12:15:03,681 [ main] DEBUG DefaultSaveOrUpdateEventListener - object already associated with session: [de.fhg.sigma.webzeb.pojo.ZewPostag#3402163304]
2006-04-27 12:15:03,681 [ main] DEBUG Cascades - cascading to saveOrUpdate: de.fhg.sigma.webzeb.pojo.ZewPostag
2006-04-27 12:15:03,681 [ main] DEBUG AbstractSaveEventListener - persistent instance of: de.fhg.sigma.webzeb.pojo.ZewPostag
2006-04-27 12:15:03,681 [ main] DEBUG DefaultSaveOrUpdateEventListener - ignoring persistent instance
2006-04-27 12:15:03,681 [ main] DEBUG DefaultSaveOrUpdateEventListener - object already associated with session: [de.fhg.sigma.webzeb.pojo.ZewPostag#3402163104]
2006-04-27 12:15:03,681 [ main] DEBUG Cascades - done cascade ACTION_SAVE_UPDATE for collection: de.fhg.sigma.webzeb.pojo.ZewPos.zewPostags
2006-04-27 12:15:03,681 [ main] DEBUG Cascades - deleting orphans for collection: de.fhg.sigma.webzeb.pojo.ZewPos.zewPostags
2006-04-27 12:15:03,681 [ main] DEBUG Cascades - done deleting orphans for collection: de.fhg.sigma.webzeb.pojo.ZewPos.zewPostags
2006-04-27 12:15:03,681 [ main] DEBUG Cascades - done processing cascade ACTION_SAVE_UPDATE for: de.fhg.sigma.webzeb.pojo.ZewPos
2006-04-27 12:15:03,681 [ main] DEBUG AbstractFlushingEventListener - dirty checking collections
2006-04-27 12:15:03,681 [ main] DEBUG CollectionEntry - Collection dirty: [de.fhg.sigma.webzeb.pojo.ZewKopf.zewPoses#3402161804]
2006-04-27 12:15:03,681 [ main] DEBUG AbstractFlushingEventListener - Flushing entities and processing referenced collections
2006-04-27 12:15:03,790 [ main] DEBUG BasicEntityPersister - de.fhg.sigma.webzeb.pojo.ZewPos.zewPostags is dirty
2006-04-27 12:15:03,790 [ main] DEBUG DefaultFlushEntityEventListener - Updating deleted entity: [de.fhg.sigma.webzeb.pojo.ZewPos#3406177704]
2006-04-27 12:15:03,790 [ main] DEBUG ChangeTraceInterceptor - onFlushDirty für de.fhg.sigma.webzeb.pojo.ZewPos@be7667
2006-04-27 12:15:03,790 [ main] DEBUG BasicEntityPersister - de.fhg.sigma.webzeb.pojo.ZewPos.datumGeaendert is dirty
2006-04-27 12:15:03,790 [ main] DEBUG BasicEntityPersister - de.fhg.sigma.webzeb.pojo.ZewPos.zewPostags is dirty
2006-04-27 12:15:03,806 [ main] DEBUG AbstractFlushingEventListener - Processing unreferenced collections
2006-04-27 12:15:03,806 [ main] DEBUG Collections - Collection dereferenced: [de.fhg.sigma.webzeb.pojo.ZewPos.zewPostags#3406177704]
2006-04-27 12:15:03,806 [ main] DEBUG AbstractFlushingEventListener - Scheduling collection removes/(re)creates/updates
2006-04-27 12:15:03,806 [ main] DEBUG AbstractFlushingEventListener - Flushed: 0 insertions, 1 updates, 1 deletions to 6 objects
2006-04-27 12:15:03,806 [ main] DEBUG AbstractFlushingEventListener - Flushed: 0 (re)creations, 1 updates, 1 removals to 4 collections
2006-04-27 12:15:03,806 [ main] DEBUG Printer - listing entities:
2006-04-27 12:15:03,806 [ main] DEBUG Printer - de.fhg.sigma.webzeb.pojo.ZewPostag{sysFhi=80, sysMandant=FhG, sysIsn=3402163304, datumGeaendert=2006-03-22 00:00:00, tag=11, stunden=7.0, isnMaGeaendert=54786382980, sysVersion=42, zewPos=de.fhg.sigma.webzeb.pojo.ZewPos#3402162604}
2006-04-27 12:15:03,806 [ main] DEBUG Printer - de.fhg.sigma.webzeb.pojo.ZewPostag{sysFhi=80, sysMandant=FhG, sysIsn=3402163104, datumGeaendert=2006-03-22 00:00:00, tag=10, stunden=7.0, isnMaGeaendert=54786382980, sysVersion=42, zewPos=de.fhg.sigma.webzeb.pojo.ZewPos#3402162604}
2006-04-27 12:15:03,806 [ main] DEBUG Printer - de.fhg.sigma.webzeb.pojo.ZewPos{sysFhi=80, osy103=null, sysMandant=FhG, zewKopf=de.fhg.sigma.webzeb.pojo.ZewKopf#3402161804, sysIsn=3402162604, datumGeaendert=2006-04-27 09:03:13, zewPostags=[de.fhg.sigma.webzeb.pojo.ZewPostag#3402163304, de.fhg.sigma.webzeb.pojo.ZewPostag#3402163104], stunden=10.0, prKopf=de.fhg.sigma.webzeb.pojo.PrKopf#2477822304, isnMaGeaendert=70436131680, osy809=null, sysVersion=65}
2006-04-27 12:15:03,822 [ main] DEBUG Printer - de.fhg.sigma.webzeb.pojo.ZewKopf{sysFhi=80, sysMandant=FhG, sysIsn=3402161804, maVertrag=de.fhg.sigma.webzeb.pojo.MaVertrag#70436151780, zewPoses=[de.fhg.sigma.webzeb.pojo.ZewPos#3407188104, de.fhg.sigma.webzeb.pojo.ZewPos#3402162604], datumGeaendert=2006-04-26 17:01:51, status=1, isnMaZeb=null, isnMaGeaendert=70436131680, sysVersion=89, leistungsPeriode=component[jahr,monat]{monat=3, jahr=2006}}
2006-04-27 12:15:03,822 [ main] DEBUG Printer - de.fhg.sigma.webzeb.pojo.ZewPos{sysFhi=80, osy103=null, sysMandant=FhG, zewKopf=de.fhg.sigma.webzeb.pojo.ZewKopf#3402161804, sysIsn=3406177704, datumGeaendert=2006-04-27 10:14:56, zewPostags=[], stunden=12.0, prKopf=de.fhg.sigma.webzeb.pojo.PrKopf#2442422404, isnMaGeaendert=70436131680, osy809=null, sysVersion=43}
2006-04-27 12:15:03,822 [ main] DEBUG Printer - de.fhg.sigma.webzeb.pojo.ZewPos{sysFhi=80, osy103=null, sysMandant=FhG, zewKopf=de.fhg.sigma.webzeb.pojo.ZewKopf#3402161804, sysIsn=3407188104, datumGeaendert=2006-04-26 17:38:05, zewPostags=[], stunden=10.0, prKopf=null, isnMaGeaendert=70436131680, osy809=de.fhg.sigma.webzeb.pojo.Osy809#1004050987, sysVersion=0}
2006-04-27 12:15:03,822 [ main] DEBUG AbstractFlushingEventListener - executing flush
2006-04-27 12:15:03,822 [ main] DEBUG BasicEntityPersister - Updating entity: [de.fhg.sigma.webzeb.pojo.ZewPos#3406177704]
2006-04-27 12:15:03,868 [ main] DEBUG BasicEntityPersister - Existing version: 43 -> New version: 43
2006-04-27 12:15:03,868 [ main] DEBUG AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2006-04-27 12:15:03,868 [ main] DEBUG SQL - update ZEW_POS set SYS_VERSION=?, ISN_ZEW_KOPF=?, ISN_PR_KOPF=?, ISN_OSY103=?, ISN_OSY809=?, SYS_MANDANT=?, SYS_FHI=?, ISN_MA_GEAENDERT=?, DATUM_GEAENDERT=?, STUNDEN=? where SYS_ISN=? and SYS_VERSION=?
2006-04-27 12:15:03,868 [ main] DEBUG AbstractBatcher - preparing statement
2006-04-27 12:15:03,868 [ main] DEBUG BasicEntityPersister - Dehydrating entity: [de.fhg.sigma.webzeb.pojo.ZewPos#3406177704]
2006-04-27 12:15:03,868 [ main] DEBUG LongType - binding '43' to parameter: 1
2006-04-27 12:15:03,868 [ main] DEBUG StringType - binding 'FhG' to parameter: 6
2006-04-27 12:15:03,868 [ main] DEBUG TimestampType - binding '2006-04-27 12:15:03' to parameter: 9
2006-04-27 12:15:03,868 [ main] DEBUG DoubleType - binding '12.0' to parameter: 10
2006-04-27 12:15:03,868 [ main] DEBUG LongType - binding '43' to parameter: 12
2006-04-27 12:15:03,884 [ main] DEBUG AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2006-04-27 12:15:03,884 [ main] DEBUG AbstractBatcher - closing statement
2006-04-27 12:15:03,884 [ main] DEBUG BasicEntityPersister - Deleting entity: [de.fhg.sigma.webzeb.pojo.ZewPos#3406177704]
2006-04-27 12:15:03,884 [ main] DEBUG BasicEntityPersister - Version: 43
2006-04-27 12:15:03,884 [ main] DEBUG AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2006-04-27 12:15:03,884 [ main] DEBUG SQL - delete from ZEW_POS where SYS_ISN=? and SYS_VERSION=?
2006-04-27 12:15:03,884 [ main] DEBUG AbstractBatcher - preparing statement
2006-04-27 12:15:03,884 [ main] DEBUG LongType - binding '43' to parameter: 2
2006-04-27 12:15:03,962 [ main] DEBUG AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2006-04-27 12:15:03,962 [ main] DEBUG AbstractBatcher - closing statement
2006-04-27 12:15:03,962 [ main] ERROR AbstractFlushingEventListener - Could not synchronize database state with session
[/b]


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 27, 2006 11:48 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Use <key not-null="true">, which is not the same as <key><column not-null="true" .../> ...</key>. That will ensure that deletes happen in the correct order, i.e. before the update.

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 28, 2006 3:06 am 
Newbie

Joined: Thu Apr 27, 2006 5:51 am
Posts: 5
Your right. Thats an error in the mapping files.
Thanx.
Still it does not fix the problem.
Actually i am not worried about the sequence of update / delete. In the testcase there should be no update at all.
I still believe, the problem is the way the deleted state is made, which then is compared to the loaded state in the dirty check. Unfortunately I don't see a solution...
Regards
Jochen


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 03, 2006 6:46 am 
Newbie

Joined: Thu Apr 27, 2006 5:51 am
Posts: 5
Solved (by workaround) the Problem.

Cause is our interceptor. Found (by reading the docs) that onFlushDirty is called even if the entities state is not going to be persisted. (In our case the entity is not persisted because the dirty column is not updateable, which is checked later in the processing of the flushevent.)

So our interceptor has to check if the entity is truly dirty before setting change date and user.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.