After reading more about this online, it seems that ORMs have a
difficult time mapping to composite keys. So, if the above is not
possible, would creating FooBar to have an autonumber/serial primary
key with fooId and barId as foreign keys that are unique together work
the same/better? This may be what MappedPasswords is doing??
CREATE TABLE FooBar
(
id serial NOT NULL,
fooId long NOT NULL,
barId long NOT NULL,
FOREIGN KEY ( fooId ) REFERENCES Foo ( id ),
FOREIGN KEY ( barId ) REFERENCES Bar ( id ),
PRIMARY KEY ( id )
);
CREATE UNIQUE INDEX index_name ON FooBar (fooId, barId);