db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakob Braeuchi <jbraeu...@gmx.ch>
Subject Re: Problem with Inheritence: Get the wrong class back!
Date Wed, 10 Dec 2003 19:55:09 GMT
hi andrew,

ojb requires a primary key to be _unique_ within a hierarchy defined in 
the repository.

jakob

Clute, Andrew wrote:

> So, say I have a concrete class named 'foo', and another concrete class
> named 'bar' that extends foo.
> 
> In one instance of my code I do a QueryByIdentity for a class of type 'foo'
> with a certain PK. This loads it into the cache with that Identity.
> 
> Later on, I attempt to do a QueryByIdentity for the same PK, but this time
> with the class 'bar' (and in this case, this is perfectly legal casting) --
> however, when OJB sees this PK in the cache, it returns that object, and
> before it returns it all the way up it sees that foo is not assignable to
> bar and throws a warning, and returns null.
> 
> So, in essence, I have a race condition -- if I first look for it with the
> class being 'bar' it works great from then on using either 'foo' or 'bar',
> but if I use 'foo' first, it is in the cache as 'foo' and will never be
> returned as 'bar'.
> 
> Thoughts?
> 
> 
> ---------------------------------------------------------------------
> 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