BTP CAP Part 5: Domain Modeling with Entities, Associations, Compositions and Aspects
Preview · a free account unlocks the full lesson
Model the domain well in CDS: entities with keys (cuid), reusable aspects (managed, temporal), types and code lists, associations (references) vs compositions (contained children with deep insert/delete), and modeling patterns that keep services and UIs simple.
In this lessonShow sectionsHide sections
Visual overview
Explanation
Part 4 covered SaaS and multitenancy; this part returns to the domain model itself — entities, associations, compositions and aspects. The @sap/cds/common library provides reusable aspects such as cuid for a UUID primary key, managed for automatic created/modified fields, and Currency, Country and CodeList for common reference data. Associations reference genuinely independent entities, for example an Order referencing a Customer.
Compositions model contained children, such as an Order containing Items, and come with deep insert, deep update and cascading delete behavior built in. Whatever the model ends up looking like, it should stay independent of any single UI or consumer rather than being shaped around one specific screen.
Create a free account to keep reading
You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.
- Full explanation
- Code example
- Real project scenario
- Common mistakes
- Best practices
- Interview angle
One tap with Google works too. Every topic keeps its first lesson open to everyone.
Keep exploring
Interview questions on this topic
Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.