On Mon, Jun 03, 2002 at 12:30:08PM -0600, Bruce Snyder wrote:
[...]
> Castor currently does not support a compound primary key containing
> a foreign key - and I think this is what you're describing.
No, that's not 100% what I tried to describe. Perhaps I should state
a clearer example.

Pseudocode:
class Person {int id, String name, Address _adress} (and set/get-methods)
class Adress {String city} (and set/get-methods)

table a (int id, varchar name) // maps to class Person
table b (int id, varchar city) // maps to class Adress

id in class person and table a is my single primary key. id in b is a
foreign-key referencing my primary key.

I'd like to do:
Person p = new Person(); p.setName("one"); Address a = new Address();
a.setCity("New York"); p.setAddress(a); db.create(p);
p = new Person(); p.setName("two"); db.create(p);
p = new Person(); p.setName("three"); a = new Address();
a.setCity("Boston"); p.setAddress(a); db.create(p);

and getting
table a
id      name
1       one
2       two
3       three

table b
id      city
1       New York
3       Boston

Can this be done?

-- 
CU,
   Patrick.

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to