Hi,
In my class Mapping "A" I have two <set>s: "A2B" and "A2C", which map to a many-to-many table:
Code:
<set
name="A2B"
order-by="sortOrder">
<key column="fk_A" />
<one-to-many class="A2B" />
</set>
both definitions, for B and for C are identical.
The
A2B class contains a composite PK:
Code:
<composite-id class="A2BPK" name="id">
<key-many-to-one
class="B"
column="fk_B"
name="B"
/>
<key-many-to-one
class="A"
column="fk_A"
name="A"
/>
</composite-id>
Again, in the class A2C its the same, this time with C instead of B.
When adding new entries to the many-to-many relationship I do:
Code:
A2B a2b = ...
session.insertOrUpdate(a2b);
a.addToA2B(a2b);
session.flush();
On B It is all ok.
On C I get a stale link error.
Quote:
org.hibernate.StaleStateException: Batch update returned unexpected row count from update: 0 actual row count: 0 expected: 1
at org.hibernate.jdbc.BatchingBatcher.checkRowCount(BatchingBatcher.java:88)
at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:74)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:172)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:226)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:137)
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:675)
Eventhow everything is identicall :-( (except for the way hibenate handles those collections :-( , and ofcause - B is different than C... :-) )
Any tips will be most appreciated...
Cheers,
Ron
[/quote]