Exporting 2 duplicate mendix tables to 1 oracle table

4
The customer wants an export of Mendix data to an Oracle database, so they can query the data themselves in any way they want. There are 2 tables in mendix which have the same structure, and the customer wants the data of these two tables in one oracle table. Probably this will be a problem because of the primary keys and references with the primary to other (also kind of duplicate) tables. Now I 'm thinking of change the primary keys of the table and and foreign keys of the references) to negative integers, but maybe someone has a better solution?
asked
1 answers
3

You are probably using the ObjectStoreId as the primary key of your table. This key is always unique within one object type.
In the Mendix runtime environment a GUID is used to identify all objects. The GUID is a unique nr over all object types. Two different objects can never have the same guid. But GUID change when you restart the XAS. So you can not used this as your identifier.

What you can do is create a hash based on your objecttype and generate the primary key something like this.

 Long objectId = Long.valueOf(String.valueOf(PrijsGunningsvraag.getType().hashCode()) + String.valueOf(iMxObject.getId().getObjectStoreId()));
 //Or if you want to do this reusable
 Long objectId = Long.valueOf(String.valueOf(iMxObject.getType().hashCode()) + String.valueOf(iMxObject.getId().getObjectStoreId()));
answered