Issue
When attempting to publish an OData Service using Studio Pro, users may encounter an error identified by the code CE6585.
Published entity 'Module.EntityName' must have a key definedEnvironment
Studio Pro 9.17.0 and newer
Cause
This error arises when an entity is added without specifying a key attribute. The key attribute is crucial as it uniquely identifies each record within the entity, and without it, the system cannot properly manage the data.
Older Studio Pro versions used Mendix Identifier (unique) as key and hence users did not have to explicitly select unique attributes as key.
Selecting a single attribute as key was introduced in Studio Pro 9.17.0. Selecting multiple attributes as key (only for OData 4) was introduced in Studio Pro 9.19.0.
Solution/Workaround
To resolve this issue, it is essential to ensure that every entity you create includes a designated key attribute. This attribute acts as a unique identifier, enabling the OData Service to function correctly and maintain data integrity. By defining a key attribute for each entity, you can prevent the CE6585 error from occurring and ensure a smooth publishing process for your OData Service.
The key attribute can be chosen when adding the entities.
Or, after the entity was added, on the Entity panel, on the right side, click on Add, then mark the checkbox to set the attribute as key.
Internal information related
- 239979
- C0A044PPS/p1738768006572909
0 Comments