In CDS (Core Data Services), both Composition and Association are used to establish relationships between two or more entities, but there are some key differences between the two:
Composition: In composition, a parent entity contains one or more child entities. The child entities are considered to be part of the parent entity, and their lifecycle is dependent on the parent entity. In other words, if the parent entity is deleted, the child entities are automatically deleted as well. This relationship is denoted by the "composition" keyword in the CDS definition.
Association: In association, two or more entities are related, but they are not dependent on each other. Each entity can exist independently of the other. This relationship is denoted by the "association" keyword in the CDS definition.
In summary, the main difference between Composition and Association in CDS views is that in Composition, the child entities are considered part of the parent entity and their lifecycle is dependent on the parent entity, while in Association, each entity can exist independently of the other.