mappedBy 單向關(guān)系不需要設(shè)置該屬性,雙向關(guān)系必須設(shè)置,避免雙方都建立外鍵字段數(shù)據(jù)庫中1對多的關(guān)系,關(guān)聯(lián)關(guān)系總是被多方維護(hù)的即外鍵建在多方,我們在單方對象的@OneToMany(mappedby="")把關(guān)系的維護(hù)交給多方對象的屬性去維護(hù)關(guān)系。 對于mappedBy復(fù)習(xí)下 a) 只有OneToOne,OneToMany,ManyToMany上才有mappedBy屬性,ManyToOne...
www.dbjr.com.cn/article/2311...htm 2025-5-28