db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Wieland" <peter.wiel...@gmx.de>
Subject WG: Cache and Inheritance
Date Thu, 08 Jul 2004 11:37:17 GMT
Hi again,

I digged a little deeper. The problem occurs in fact, when a class is in
more than one extent. In my example, Product implements two interfaces
TextLinkable and ImageLinkable. I'm afraid this scenario was not one, OJB
developers thougt about.

In DescriptorRepository.addExtent(String classname, ClassDescriptor cld),
mappings between extents and the class descriptors of their superclasses are
stored. If interfaces come into play - i.e. one class may belong to more
than one extent - the last extent added wins as each extent/superclass
mapping uses the extent class name as unique key and thus previously
registered mappings are simply overwritten.

In my example, getBroker().getTopLevelClass(Product.class) returns
ImageLinkable.class. Hence, it is not found in the cache when looking for it
as a TextLinkable (Identity.equals() compares toplevel classes and OIDs).

Is there an easy way to get this fixed?

Regards,

Peter

PS: While writing this mail, I felt like this belongs more to the developer
list. Maybe we can continue discussion there. I sent a copy to both lists.

-----Urspr√ľngliche Nachricht-----
Von: Peter Wieland [mailto:peter.wieland@gmx.de] 
Gesendet: Donnerstag, 8. Juli 2004 10:48
An: ojb-user@db.apache.org
Betreff: Cache and Inheritance


Hi all,

I just wrote the following mail to the user list. Here it is a second more
time for two reasons:
1) I used a mail account not subscribed to the list, hence I do not know
whether it will be accepted.
2) I just updated my App for use with OJB 1.0. The problem did not change.
So forget about my last question whether the problem is fixed or not in 1.0.
It is NOT.

Peter

===

Hi all,

I have the following scenario: 

<<interface>> TextLinkable (0..*)---(0..1) TextModule

And a class Product implementing TextLinkable (Product is declared as extent
of TextLinkable in repository).

It now appears that I have different instances of the same Product in my App
which is not what I expect. Normally the use of a cache makes sure that
persistent identity is equivalent to java identity (which works fine in most
cases). I suppose that the cache does not correctly resolve identities when
inheritance comes in to play. 

The TextModule class holds a dynamic proxy for the associated TextLinkable.
Is it possible, that, when materializing this proxy, it does not find an
existing Product (which would be the real object in this case) in the cache,
because the cache is searched for classes of runtime type TextLinkable
(there are none, as TextLinkable is an interface)?

I observed the problem with OJB RC5. Is this a known problem? Anybody knows
whether it is fixed in 1.0?

Thanks for any help.

Peter


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-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