on 2023 Jan 19 9:55 AM
Hi,
this may sound stupid but I find it really annoying how the names are generated for properties related to managed associations/compositions. E.g. if I have something like this:
group : Association to PromotionGroups;
it generates property group_id. This is documented in CAP documentation. My problem is that all properties use camel case names but just these properties use _. Even the properties added automatically by draft handling have nice names like IsActiveEntity.
I don't see any way how to change this in CAP documentation. Is there a way? If I switch to unmanaged association/composition where I can define my own property, what do I lose? I know that I will lose foreign keys. Is there anything else? Are managed association really that beneficial? I have to provide nicer error messages for these fields anyway so I will have a logic for validation in the service layer anyway.
Or is there any other way how to provide nicer names for these properties?
Thanks
Request clarification before answering.
Hi Martin, you probably want to read my answer from 2021 to this question: https://answers.sap.com/questions/13302506/rename-a-column-generated-by-sap-cap-cds.html?childToView...
Regards, Hans-Joachim
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Martin,
do you know that we already generate referential constraints for managed associations as described in the capire documentation on constraints and that in the most generic way there is no need to decorate associations with 'constraint' annotations?
We have put a lot of thought into the design to let a highly complex database operation appear easy for the user. One of the prerequisites for constraints are that they comprehend the full primary key tuple of the 'leading' entity. Therefore we decided to create managed constraints with one consistent behaviour for managed associations only.
Regarding your "for all databases": Constraints are generated for SQLite and SAP HANA.
BTW, our constraints are 'initially deferred' which means that they won't be enforced on already existing content. This way we allow to add DB constraints later on without locking up the deployment.
Feel free to ask if you have open questions.
HTH
User | Count |
---|---|
62 | |
8 | |
7 | |
6 | |
6 | |
4 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.