You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Lynn Monson <ly...@nextpage.com> on 2003/03/11 20:05:09 UTC
Single table for a 1:1 association
My apologies in advance if this is a newbie question.
I have two objects, ObjectA and ObjectB that are in a 1:1 association.
I'd like to map them both to a single DB table using one row to hold a
pair of ObjectA/ObjectB instances. For example, if the objects look
like this:
class ObjectA {
int id;
String name;
ObjectB b;
...
}
class ObjectB {
int foo;
int bar;
...
}
I'd like single table that contains "id", "name", "foo", and "bar" as
separate columns.
I can see how to use a RowReader to read ObjectA/ObjectB instances in
from a single table, but I can't see how to write an instance of
ObjectA/ObjectB out to the same table.
Any help is greatly appreciated.