db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oliver.m...@ppi.de
Subject RE: Identity.realClass set to abstract class?!
Date Thu, 21 Aug 2003 08:48:33 GMT
Hej Armin,

> -----Original Message-----
> From: Armin Waibel [mailto:armin@code-au-lait.de]

[..]

> > 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 ...)

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?

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


Mime
View raw message