Skip to Content

Error ASSERT_REFERENCE_INTEGRITY on CAP Compositions

Hello everybody!

I am creating two entities following CAP tutorial, one of them is composed by the other, so the schema would be this:

entity Proposal {
	key ID: UUID;
	budgets: Composition of many Budgets on budgets.proposal = $self;
}

entity Budget {
	key proposal: Association to Proposal;
	key ID: String(2);
}

If I exposed my service and I try to make a POST request with this body:

{
	"desc": "First example",
	"budget": [
		{
			ID: "AA"
		},
		{
			ID: "BB"
		}
	]
}

First call returns a 201 code, so it is ok, but if I try a second request with the same data, it returns the following error:

{ "error": { "code": "ASSERT_REFERENCE_INTEGRITY", "message": "Reference integrity is violated for association 'proposal'", "target": "api.Proposal" } }

I don´t understand this error since I am using a different key for Proposal so it could create another two registries for Budget.

Thank you for the response.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on May 06 at 09:55 AM

    Hi,

    The issue is fixed and the fix will be avalable with the next release.

    Best regards,

    Olena

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 02 at 07:36 AM

    Hi,

    thanks for reporting this. I was able to reproduce - actually in my setup, the error occurs already with the first request. Could you please check again that you get a 201 the first time? Which version of cds are you using? Would be interesting to understand the difference between your model and my test model...

    Nevertheless it looks as if the referential integrity check doesn't work properly in case of deep insert. We will have a look and will let you know when this is fixed.

    Best regards,

    Heiko

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.