Am I in a trap ? What are the benefits of using single pk supplied by OS platform ?

Attached follow the analysis I did to try to solve my doubts. It is a suggestion to OS to create a new feature too.
I am worried about the limitation I have using long integer as primary key.

I am building a product that can be adopted quickly.  So, I would like to know if someone decided to implement manually composite keys and if there is another approach to minimize the time to delivery it during developement.
Maybe I am worried for nothing but I will be delivering a system that is so generic that could be used for any person in any place and its database is centralized.

I wish a good day for all
Hi Luciano,

I don't think you need to worry as it is just a mind shift if you are coming from Natural Keys and Composite keys to a purely surrogate based database design. You still do have composite keys via the use of SQL queries and supported by indexes. 

It would be nice thou if Indexes were visually scoped under their entities (i dont know if Outsystems allows for sql views across tables) and if you dragged them into an action an Aggregate was created based on the index attributes...

Maybe some one can answer what an entity with composite keys is represented in Outsystems if imported from SQL Server for example? Maybe I will give it a little test.(edited: no icant as i only have access to personal edition)

I like your example and I to was playing with associations relationships..I just dropped the default id but then as you know you dont have the default crud functions BUT if you keep the defaukt ID but make it type one of your source keys then you get the crud functions!


Hi George,
   thanks for your tips.
At glance I think that the DeleteAssociation will not work well because probably there is only a unique id as parameter. By analogy I think that GetAssociation will have the same problem. Based on this, would be wise disable then to avoid problems on maintenance...  Am I right ?

Well then that is a bust then as if I came across this I would say the developer was fighting the platform.

But composite key support is missing and there is no clear consensus between OO and Data people which is best but a zealots position of 100% one or the either I do disagree with and this is the position Outsystems has taken which is understandable due to the OO .NET background But this position will hurt the adoption by system of records people, ERP, dare I say enterprises people. 

I will use surrogate keys as I want scaffolding and I want aggregates and I want default crud functions But others will use this an excuse to dismiss the platform. 
I would add in a previous job I had to investigate the performance issue of an SQL Server and the identical implmentation of a the database in Oracle and Microsoft Labs confirmed that your foreign keys need to be placed at the top of the table instead of logically where you feel the attribute business wise fits in the table record format. In the Oracle implmentation this made no difference but as we were using a tool similar to Outsystems we changed the database schema to make both implmentations happy!

Hi Luciono,

Platform 9's Long Integer is a 64 bit integer, not a 32 bit as you seem to assume. That means its value goes to 9,223,372,036,854,775,807 (if signed, I'm not sure whether the Id uses a signed or unsigned value), so I doubt you have a use case that would exceed such a high number (I even doubt you could add records quickly enough to have it exceed that value during your lifetime :)).

That said, if you really do not want an auto number, why not delete it, and create a manual unique index over the two (or more) attributes you want as a key? Wouldn't that be effectively the same as a composite key?
Hi Kilian,
  good to know that OS is using 64 bits. That solves the problem.

Thanks for your comments and the ones from George too.

Have a good day guys
Hi Kilian,
   could you supply the source you used to say that Platform 9's Long Integer is a 64 bit integer ?  In my task manager the OS is 32 bits and it seems there is no sense a 32 bits application work with 62 bits DB.

Hi Luciano,

Service Studio runs in 32bits, but the Plartform Server is always 64bits.

Long Integers are 64bits like Killian said. See here in the news topic of that feature.

João Rosado

Hi João,
   thanks for the source.


32 bit is just the limit of the CPU's register width, it has little to do with what data it can handle. On a good ol' 16 bit PC/XT, it was still possible to use 32-bit longs in C, for example :).