-->
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.  [ 3 posts ] 
Author Message
 Post subject: Stale Link Exception
PostPosted: Tue May 17, 2005 5:55 am 
Newbie

Joined: Wed Apr 13, 2005 8:10 am
Posts: 15
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]


Top
 Profile  
 
 Post subject: for clarification:
PostPosted: Tue May 17, 2005 5:57 am 
Newbie

Joined: Wed Apr 13, 2005 8:10 am
Posts: 15
The B and C are different mapping to two differemtn m-2-m tables. They are from the strcuture and grammar identicall, but handle different relationships.


Top
 Profile  
 
 Post subject: RESOLVED
PostPosted: Tue May 17, 2005 6:09 am 
Newbie

Joined: Wed Apr 13, 2005 8:10 am
Posts: 15
When changing
Code:
A2B a2b = ...
session.saveOrUpdate(a2b);
a.addToA2B(a2b);
session.flush();


to

Code:
A2B a2b = ...
[color=red]session.save(a2b);[/color]
a.addToA2B(a2b);
session.flush();


did the trick.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.