-->
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: Instanciacing wrong subclass
PostPosted: Wed May 16, 2007 10:34 am 
Regular
Regular

Joined: Fri Feb 03, 2006 5:28 pm
Posts: 73
Location: Québec, QC, Canada
Hi everyone,

I have 3 classes which 2 of them are subclass of the first one.

Member
Responsable (which is a subtype of member)
Formatteur (which is a subtype of member)


I happen to have at least one member that is both Responsable AND Formatteur. So at some point in my code, I need a list
of Formatteur.. but when nhibernate tries to load the list, it looks for that specific member and first find that he is
a Responsable, so create that member as Responsable.. but the list is suppose to be of Formatteur type. I'm then getting
this error:

Object with id: 44308 was not of the specified sublcass: Com.CompanyName.Responsable (loading object was of wrong class)

Here is what I use to get the list:
IQuery q = session.CreateQuery("from Responsable r where r.Login='" + login + "'");

responsables = q.List();


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.