How are IDs handled when converting an existing entity into a specialization of a new generalized entity?

0
Currently, we have existing table A with data that we want to convert into a specialized entity.    Here is what we are currently seeing: table A has IDs 1,2,3,4 and these get converted to a generalized table B we then create an objects in table C(inherits from B) and they get IDs 8,9,10 If we go to create another object in table A it is given ID 5 - I would have expected it to continue with ID 11   This makes it look like there is a possibility of the ID collision in the generalized table. Are we misunderstanding this, or does Mendix handle this scenario and make sure 2 objects never have the same ID?  
asked
1 answers
8

Objects in a Mendix application can never have the same ID. In the ID of the object of a specific entity there is also a part of it the unique ID of that table. 

The Object ID consists of:

  1. a 16 bit code for the entity type (table name);
  2. a 48 bit code for the number in the sequence of the entity

 

Those binary codes are combined and transformed to an integer representation.

 

Example

Let's say we have entity with ID 28 and the 208th object of that entity type, so:

  1. Entity ID = 00000000 00011100
  2. Object ID = 00000000 00000000 00000000 00000000 00000000 11001010

 

Those two combined give a binary representation: 00000000 00011100 00000000 00000000 00000000 00000000 00000000 11001010.

Transforming this to an integer gives: 7881299347898570  which looks pretty much like a typical Mendix Object ID.

For translating binary to integer values, you can use: https://www.mathsisfun.com/binary-decimal-hexadecimal-converter.html

answered