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: Foreign key lookups
Date Wed, 31 Mar 2004 14:27:41 GMT
Hi Laurie,

There was a discussion of adding support for this type of thing about a
year ago.  The debate came when discussing adding support for more than
simply "=".  For example, when I create a query such as:

query.create("select all from " + Team.class.getName() + " where player
> $1");

What is the correct behavior?

I think it may be time to revisit this request, if only to support
equals on an object.

~~~~~~~~~~~~~~~~~~~~~~~ 
Wallace J Gelhar 

University of Wisconsin - Eau Claire 
Facilities Planning & Management 
Computer Information Systems 
715-836-3411 



-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of Laurie Harper
Sent: Tuesday, March 30, 2004 11:29 PM
To: ojb-user@db.apache.org
Subject: Foreign key lookups


I never did get a conclusive answer on this, so I'm reposting with more 
background.

What I was hoping to be able to do is something like this:

   Player p = getPlayer();
   OQLQuery query = odmg.newQuery();
   query.create("select all from " + Team.class.getName() +
                " where player = $1");
   query.bind(p);
   query.execute();

Unfortunately, that results in an error because Player is not 
serializable. If I modify the code like this everything is fine:

   query.create("select all from " + Team.class.getName() +
                " where PLAYER_ID = $1");
   query.bind(new Integer(p.getID());

The only problem is that the ID property on Player is set up using 
anonymous access... I want to minimize the number of database artifacts 
I add into my object model and, since the integer PK columns in the 
database exist for join performance rather than semantic relevance to 
the object model, they're something I'd rather not expose through the 
java APIs.

So, my first question is should what I tried first work? OJB has the 
information it needs to implement support for this (from the repository 
descriptor) but is it outside the ODMG specification?

Second question is, if I can't do what I first tried, can I use 
OJB-specific APIs to work around the OQL limitation? This is more for 
interest, since if I have a choice between 'cluttering' my object model 
and breaking compliance with ODMG, I'll choose the former. I just want 
to know if those really are my only choices...

L.


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