[odb-users] One-to-many relationship in composite primary key

Andrea Pappacoda andrea at pappacoda.it
Sun Jan 31 10:21:23 EST 2021


I have two entities, school and class. School has a simple primary key (id), while class has a primary key composed by a name and a reference to its school.

In SQL terms:

CREATE TABLE school (

id BIGINT NOT NULL PRIMARY KEY

);

CREATE TABLE class (

school_fk BIGINT NOT NULL REFERENCES school (id),

name VARCHAR (30) NOT NULL,

PRIMARY KEY (school_fk, name)

);


How can I implement this with ODB?


Section 7.2.1 of the manual states that a composite value type cannot have any object pointers, is this a thing that ODB can't do?


Thanks for the help.



More information about the odb-users mailing list