Re: [Modeling-users] toOne relationship returns base class instead of subcl
Status: Abandoned
Brought to you by:
sbigaret
From: Sebastien B. <sbi...@us...> - 2004-07-23 13:03:18
|
John Lenton <jl...@gm...> wrote: > in the model >=20 > Person > / \ > | > PhysicalPerson <---->> Address >=20 > querying an Address for its PhysicalPerson returns Person instances, > which was unexpected (for me, at least). Is this correct, or is it a > bug? If you mean that, having an address 'addr', addr.getPerson() has class 'Person', yes, this is intended, as long as addr.getPerson().isFault() is True. As soon as you'll need an addr's person property the fault will be fired and you'll get the correct class for addr.getPerson(). Now you may wonder why this is like this. We discussed this here: https://sourceforge.net/mailarchive/forum.php?thread_id=3D3457563&forum_id= =3D10674 See esp. the third post dated 2003-11-15 20:40. While the example taken there involves a relationship pointing from a subclass to its root class, you'll see that you get exactly the same kind of problem if you add a class Photo such as: Photo <<---> Person Now you'll see that the discussion "ended" there with an open question, about if and how this could/should be changed. Time to rediscuss this I guess, huh? -- S=E9bastien. PS: BTW the interesting methods on this topic:=20 DBChannel.fetchObject() calling DBContext.initializeObject(), which in particular populates the object's toOne properties with DBContext.faultForGlobalID(). and this particular behaviour is tested in:=20 test_EC_Global_Inheritance.test_02_toOneFault() |