Boris Romashov wrote:I repeat the following requirement:
>> I don't want redundant fields in database.
No need to get testy. I'm really only trying to help.
I guess I've always been incorrectly taught that two associated table in a database needed to be referenced through a foreign key. It appears that this 'foreign key' idea that I've been misinformed about is superfluous and redundant.
How do you enforce a constrained association between two tables without an apparently redundant and superfluous foreign key? I'm curious.
Cameron Wallace McKenzie wrote:
How do you enforce a constrained association between two tables without an apparently redundant and superfluous foreign key?
Each field in the table can be used as foreign key, even primary key. In table A field id can be autoincrement, in table B it should be usual integer that is linked with table A.
The same happens when a table builds many-to-many relationship. It doesn't have any special primary keys. We use pair of foreign keys as a natural primary key. I want the same but for one foreign key instead of two.
Is it impossible in JPA ?
LOOK! OVER THERE! (yoink) your tiny ad is now my tiny ad.
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth