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.  [ 1 post ] 
Author Message
 Post subject: StaleObjectException and Components
PostPosted: Mon Aug 27, 2007 1:51 pm 
Contributor
Contributor

Joined: Sun Jun 26, 2005 5:03 am
Posts: 51
Location: London, UK
I have an issue with a save on an object with multiple components giving a StaleObjectException and wondered if anyone else has come across it.

Very simple class called Office which has three component classes; Address and two instances of TelephoneNumber called Telephone and Fax.

My standard suite for the Dao class has three tests; Save, Update and Delete. The DAO is instantiated for each new test, but the Session is retained via a singleton; this may be generally not best-practice, but it's been working for over a year now so I don't think it's the underlying problem.

Each test runs ok all by itself, but when run together either Save or Update fails, as its somehow retaining a reference to the Office object created by the previous test even though the test pattern looking like this..

T entity = DefaultEntity();
Dao.SaveEvict(entity);
Dao.Flush();

Now, what is very odd is that if I change the mapping so that there is only one component present, the tests all work correctly, so although there may be something incorrect with my code, I don't like the idea that just changing the mapping can cause an internal failure.

I have about 10 projects with 100s of classes running successfully through this framework and this is the only instance where it's blowing up!

Can't see anything unusual with the classes; the components override Equals and GetHasCode etc, etc, so I'm just wondering if anyone else has come across something similar.

Can't post the code at the moment as it contains some client proprietary stuff and I don't have a simple test case as yet (next task!)

_________________
Paul Hatcher
NHibernate Team


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

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.