cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Accepted Solutions (0)

Answers (2)

Answers (2)

OlenaT
Advisor
Advisor

Hi,

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

Best regards,

Olena

0 Kudos

Good news!

Thank you very much!

heiko_witteborg
Explorer
0 Kudos

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

maheshpalavalli
Active Contributor
0 Kudos

And it's working for non uuid keys perfectly. (when the parent key is passed in the request)

0 Kudos

Yes, if you don´t use UUID keys, it works perfectly. Now I have fixed, with a UUID key in my son entity, this works but I have a new column which is not neccesary (cod should be enough to identify it).

Thank you.