db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gelhar, Wallace Joseph" <GELHA...@uwec.edu>
Subject RE: Problem with Inheritence: Get the wrong class back!
Date Thu, 11 Dec 2003 20:17:33 GMT
Hi Andrew,

No, only the classes within an extent need to be unique.  So you will
need GUID only if you map your base class (with all other classes as
extents) in the repository.  This is not recommended as it will be a
performance nightmare.

Wally

-----Original Message-----
From: Clute, Andrew [mailto:Andrew.Clute@osn.state.oh.us] 
Sent: Thursday, December 11, 2003 1:52 PM
To: 'OJB Developers List'
Subject: RE: Problem with Inheritence: Get the wrong class back!


So, is that to say then if all of your objects inherit from a single
base object, then none of the objects can have the same primary key?
They need to be guids?

-Andrew



-----Original Message-----
From: Jakob Braeuchi [mailto:jbraeuchi@gmx.ch] 
Sent: Wednesday, December 10, 2003 2:55 PM
To: OJB Developers List
Subject: Re: Problem with Inheritence: Get the wrong class back!


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

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