db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clute, Andrew" <Andrew.Cl...@osn.state.oh.us>
Subject Problem with Inheritence: Get the wrong class back!
Date Mon, 08 Dec 2003 22:27:38 GMT
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'.


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

View raw message