当前位置:网站首页>Association relationship

Association relationship

2022-06-11 16:44:00 Peach

Associations can also be broken down into aggregation and composition ( The specific concepts of the two are searched by the readers themselves ).

        Discovery of aggregation 、 Combination can be understood from another angle .

       Let's start with aggregation , It is a weak correlation , The general meaning is that the whole and the part can exist independently . If we change the angle , It can be regarded as a cascading operation of the database .

       Take the group and its members for example , When deleting a group , Delete the members of this group , This is obviously unscientific , Because the group and its members are weakly related , The group can have any one member , A team member can also go to any group , This group no longer exists , You can go to another group , They are not necessarily related , It can be called aggregation .

       therefore , When we were designing the database , Cascading deletion is often not set , in other words , Deleting a group does not delete group members .

       UML The figure is as follows :

       Hollow diamond for aggregation , Point to one End .

       Let's talk about combination , Composition is a strong association , The general meaning is that the whole and the part are inseparable , Can't exist independently . Also understand from cascade operation .

       Take students and student ID cards for example , If a student drops out , No longer belong to this school , Then consider deleting the student information , When deleting , The student ID information corresponding to the student will also be deleted , Cascade deletion can be added here . Because the student ID card belongs to a student's proprietary information , The student no longer exists , The student ID card cannot be used by others , So it's a strong correlation , It can be called combination .

       UML The figure is as follows :

原网站

版权声明
本文为[Peach]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206111630047706.html