cancel
Showing results for 
Search instead for 
Did you mean: 

UUIDs and Unique Semantic Primary Keys

jayme_alonso
Participant
0 Kudos

Hi Experts,

I'm working with RAP in BTP and have a question regarding UUIDs and semantic primary keys.

What is the best and recommended way to guarantee the uniqueness of a semantic primary key?

In RAP and OData V4, UUIDs provide us with the ability to create entities in draft mode without needing to validate the keys in the creation popup, which has limitations for more complex checking and responding with messages. Often, these validations result in the popup closing, causing the user to lose the data they have entered and forcing them to re-enter it.

I believe using automatically generated UUIDs allows us to move directly to the edit screen, where we have more control for validations and displaying messages without losing the input data.

I have two options already envisioned for helping me with this issue:

  • Using a validation for create and updating the BO (select in the table and check for uniqueness). Which I'm already using but I think there might be a better way for it
  • Using an unique index in the table and handling the errors. I've not implemented this solution but I imagine would be less cumbersome to implement.

I'm looking forward to hear the input from the colleagues,

Jayme

 

View Entire Topic
peterpersiel
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Jayme,

Number Range Solution could be used to retrieve unique numbers.

Best regards,
Peter

jayme_alonso
Participant
0 Kudos

Hi Peter,

Thank you for your response. Maybe I was not clear in the description. I'm talking about a table with related keys, not ones generating new records. For example, an Order Partners table where I have the key (Order/Partner Function/Partner), and I have to guarantee that the Partner appears only once for the same Order/Partner Function.

WRoeckelein
Active Participant
0 Kudos

Hi Peter,

besides the original problem being a bit different, the question here would also: When/Where in RAP you should call the numer range function?

Regards,

Wolfgang

peterpersiel
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi colleagues,

sorry then I go the question wrong.

To answer the original question then: it sounds like uniqueness checks would have to be implemented, there is a precheck operation which can be use depending on the scenario - Uniqueness Check for Primary Keys 

Regarding usage of Number Range Solution in RAP: Developing Early Unmanaged Numbering includes an example for numbering using Number Range solution

Best Regards,
Peter