-->
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: Discriminators and NHibernate using wrong subclasses
PostPosted: Wed Jul 27, 2005 10:55 am 
Newbie

Joined: Wed Jun 22, 2005 9:20 am
Posts: 4
Hi all,
This is really making me nuts, but before debugging NH, which is my next step, I decided to post it here if someone could shed some light, that would be wonderfull.

First, imagine types A e two subclasses B and C mapped using a discriminator column. 'A' has abstract properties to force B and C map some collections, but poiting to correct types (in a similar fashion: W and subclaases X Z). That works nicely!

But...

A has also a collection of A, but as A is an abstract class I'm sure the only possible elements would be Bs and Cs, anyway, I can save elements OK, but when loading them, I get:

TestCase
----> NHibernate.ADOException : could not load object
----> System.Exception : could not initialize collection:
----> NHibernate.WrongClassException : Object with id: 1 was not of the specified sublcass: Castle.ActiveRecord.Tests.Model.StrictModel.Repository (loading object was of wrong class)

The model that reproduces the error is here:
http://svn.castleproject.org/svn/castle ... rictModel/

The test cases for it (only the last one fails):
http://svn.castleproject.org/svn/castle ... estCase.cs

Any help is appreciated!

_________________
Cheers,
hammett
http://www.castleproject.org/~hammett


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 05, 2005 10:33 am 
Beginner
Beginner

Joined: Wed Jun 29, 2005 10:40 am
Posts: 30
Location: denver, co
I'm having this same problem. I thought it might be a 0.9 issue, but I backtracked to 0.8.4 and had the same issue.

It seems this appears whenever a collection of sublcasses (same table - different discriminators) are retrieved, either by an hql query or by a fetched persistent collection.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 06, 2005 2:17 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Looks like it's the same bug as NH-294 which we didn't have a test case for to fix. I'll look at it.

Update: I ran the ActiveRecord test cases now, and they all passed, so it looks like we fixed the bug already. Tylord, can you create a simple test case and attach it to NH-294 in JIRA?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 11, 2005 3:47 pm 
Beginner
Beginner

Joined: Wed Jun 29, 2005 10:40 am
Posts: 30
Location: denver, co
Sure thing. I'll have to do that at home, since I can't access sourceforge cvs from work (way too locked down firewall), so it may be a few days.


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.