You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've created a new cds project with cds init and created a db/ and srv/ service.
The db service is using a not null field with a default. The service is a projection with with Capabilities annotation;
db/
entity Test {
key ID : UUID;
VAL: Integer default 12 not null
}
srv/
@Capabilities: { Insertable: true, Updatable: false, Deletable:false }
entity Test as projection on my.Test;
When doing a POST to create a new entry with only the ID field supplied I get the following error:
{
"error": {
"code": null,
"message": "An error occurred during serialization of the entity. Not nullable value for 'VAL' must not be null."
}
}
The insert did work though as it is in the database. Secondly if I set Updatable to true the service works normally and returns the created entity without an error.
/D
The text was updated successfully, but these errors were encountered:
hi, i'm guessing that you would expect the POST to either not work at all (incl persistence) or work with a warning (given that you set a default value for VAL). right?
but -without any pun intended- i don't fully get
VAL: Integer default 12 not null
b/c i'd rather expect
VAL: Integer not null
or
VAL: Integer default 12
why both default and not null?
I would expect the Insertable (POST) to work by sending "ID" only and getting a return of "ID" and "VAL". "VAL" having the value of the default as it is not supplied.
If I do the above INSERT. With Updatable: true => this works ok.
If I do the above INSERT. With Updatable: false => this enters a records in DB, but throws an error on the service.
Hi,
I've created a new cds project with cds init and created a db/ and srv/ service.
The db service is using a not null field with a default. The service is a projection with with Capabilities annotation;
db/
srv/
When doing a POST to create a new entry with only the ID field supplied I get the following error:
The insert did work though as it is in the database. Secondly if I set Updatable to true the service works normally and returns the created entity without an error.
/D
The text was updated successfully, but these errors were encountered: