db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Armin Waibel" <ar...@code-au-lait.de>
Subject Re: Identity.realClass set to abstract class?!
Date Thu, 21 Aug 2003 19:48:19 GMT
Salve Olli,

olli wrote:
> > > However, there are various points in the code where
> > > objectsRealClass is set differently (to an abstract class
> > > in my case).  E.g. from PersistenceBrokerImpl:
> > >
> > >   // ensure that top-level extents are used for Identities
> > >   referencedClass =
> > > descriptorRepository.getTopLevelClass(rds.getItemClass());
> > >   id = new Identity(rds.getItemClass(), referencedClass, pkVals);
> 
> > hmm, if you set a real class in the reference descriptor why should
> > rds.getItemClass() return an abstract class? Can you explain more
> > detailed?
> 
> I'll try.  I have a model such as
> A --1--1--> B
>                  / \
>                 B1  B2
> 
> i.e., class A has a reference to abstract class B, which has two
> concrete subclasses B1, B2 (in my model, it has about 50 
> subclasses ...)
>

ok, now I got it!
Indeed that's a problem.
I will write a test case to expose the problem.

> The reference-descriptor is of the form:
> 
> <reference-descriptor name="myB" class-ref="B">
> 
> > > objectsTopLevelClass - the highest persistence-capable
> > >           class or interface (in the inheritance hierarchy)
> > >           that the identified object is an instance of
> > right!
> 
> Have you observered that there is a problem with that definition
> in case of multiple inheritance (which is possible in case of
> interfaces)?
> 
> Maybe we should weaken the definition (and thereby drop the
> uniqueness requirement of the Identity) and say that
> objectsTopLevelClass specifies a maximal persistence-capable
> class or interface that the identified object is an 
> instance of, where 'maximal' means that there is no
> pc class or interface above in the inheritance hierarchy.
>
> I wonder what OJB's behaviour is when
> you have a pc class C that implements two pc interfaces I and J
> and you have a reference (or collection) of item-class I and another
> of item-class J referencing the same instance (database row) 
> of class C.
> 
> Probably you get two copies of that object when you follow that 
> reference.  What do you think?
> 

brrr, think this problem transcends my understanding
of OJB's persistence implementation. Currently I don't
have the time to delve into this stuff. You ask
the right questions - think Jakob or Thomas can shed
some light on this.

regards,
Armin

> I bet such a situation should better be avoided.
> 
> Regards,
> Olli
> 
> 
> 
> 
> 
> 
> Olli
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message