Hi Achim, > -----Urspr�ngliche Nachricht----- > Von: Achim �hlenschl�ger [mailto:[EMAIL PROTECTED]] > Gesendet: Freitag, 30. August 2002 10:02 > An: [EMAIL PROTECTED] > Betreff: Mapping extent classes to legacy database > > > I try to map the following object model to a legacy database: > > public abstract class A > > public abstract class X extends A > public abstract class Y extends A > public abstract class Z extends A > > The classes X, Y, Z map to different legacy tables (TableA, > TableB, TableC) > and the primary keys are not unique among the different tables. > I.e. the number 21 might be a valid primary key for TableA as > well es for > TableB. > All works fine if I query by concrete class or the query by > base class does > not > return overlapping IDs. > However OJB seems to get confused (which seems quite logical > to me) if I > query by base > class and there are multiple IDs returned for different > concrete classes.
>From an extent point of view the id column is not a primary key as there may be overlapping values. The best thing would be a combined primary key that is unique accross the extent. Is it possible to add an additional columns to your tables that contains an additional type flag? cheers, Thomas > I could work around this problem by using database views > which manipulate > the primary keys, > but that works only for reading from the database. > > Are there any ideas how to deal with this problem? > Would it help to use the PersistenceBrokerAware interface to > fake the ID > values after > loading the objects? > > Thank you in advance, > Achim > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
