I'm not sure how OJB does it, but that would either mean a lot of queries, or an awful lot of outer joins!
I wouldn't of thought there was a way to tell OJB to pick tables based on their foreign id. Generally you use references to exact types, or supertypes that are extended by a few classes. I think the correct way to deal with this is by using extents. I say this because in the java class that references another object, you will have to use the same approach. Lets say you have a classes A,B,C,D, etc If in A it has a reference to myFriend: as you don't know the type of myFriend (could be A, B, C, D, etc), you can only refer to something that all these classes extend (or implement). So, class A extends BaseClass { BaseClass myFriend; } and all the classes muse extend BaseClass. I'm not sure what it is you're trying to map, but I've never come across a case where you always need to refer to any class. You could use extents like this, and use this where you need to reference *any* object, but you could still reference a type directly where you know what it will be. So if you know that myFriendFKID will always be a B: class A extends BaseClass { B myFriend; } You can just use a reference descriptor in the repository referencing the type B, not the BaseClass extent. Hope this clarifies things, Daniel. > -----Original Message----- > From: news [mailto:[EMAIL PROTECTED] Behalf Of Sebastian > Sent: 02 June 2004 17:47 > To: [EMAIL PROTECTED] > Subject: Re: Mapping question > > > Hi Daniel, > > I had a look at the extents now. I think this will basically work. The > problem I see is, that the database has 110 tables and all are using a > globally generated OID. In my basic class I would have to list all other > classes as extents of this one. > > What does this mean for the performance of OJB? will OJB now query all > 110 tables to find the right object? > > Since I know quite easily based on the first 3 letters of the OID what > type it is, can I somehow tell that OJB as a hint to search the > right table? > > Sebastian > > Daniel Perry wrote: > > > What about using an extent and having both types extend it. It > would pick > > the right class based on whichever table has an item with that > primary key. > > > > Daniel. > > > > > >>-----Original Message----- > >>From: news [mailto:[EMAIL PROTECTED] Behalf Of Sebastian > >>Sent: 02 June 2004 17:07 > >>To: [EMAIL PROTECTED] > >>Subject: Re: Mapping question > >> > >> > >>To simplify my question: > >> > >>I have a table containing a foreign key column and the foreign key of a > >>row points to different tables based on the first three letters of the > >>foreign key. E.g. when it starts with "art" then it points to a record > >>in the article table. When it starts with "cat" then it points to a > >>category table. > >> > >>This means OJB should based on the first three letters of the foreign > >>key know what kind of object to reference. > >> > >>What kind of custom mapper or converter or whatever do I have to write. > >> > >>Thanks, > >>Sebastian > >> > >> > >>Sebastian wrote: > >> > >>>Hi, > >>>I'm trying to map some tables with OJBs but don't know how to express > >>>their relation. Maybe someone can give me a hint. > >>> > >>>I have three tables: > >>>articles with OID as primary key > >>>categories with OID as primary key > >>>custom_fields with OID as primary key, OID_FK as foreign key > >>> > >>>OID is generated uniquely over all tables in a format: "first 3 letters > >>>of the table name" plus a "incrementing value". E.g. > >>>cat01,art02,art03,cus04. > >>> > >>>An article as well as a category can have a custom field that is stored > >>>in the custom_fields table, the OID_FK is the OID of the > >> > >>related article > >> > >>>or category. The first three letters of OID indicate the "object type" > >>>article or category. > >>> > >>>How do I have to configure the repository.xml so that always the right > >>>object (a category or an article) is referenced by an > >> > >>customField object? > >> > >>>Thanks in advance, > >>>Sebastian > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]