Hi, I have a doubt regarding the unique id generated for every object in Mendix. This ID is generated automatically by system and assigned to the object. Current scenario: I have a Web Service which fetches me all the active employees from another DB server and these returned list of employees are committed into the Mendix system in a MF. When these employees are committed to Mendix DB, a unique ID is assigned for every new object. New process: Now, there is a requirement to replace the WS with an internal scheduled job(a stored procedure) which runs at DB level, where only these two DBs(external DB and Mendix DB) are used. So that the WS call is replaced. But i have a question here, What will happen to the id column in mendix DB? How will that get generated in the new process? All your suggestions are most welcome and will definitely help. Thanks, Soumya Bindhani
Soumya Ranjan Bindhani
You should not add data to a Mendix database manually, but you should always create objects on the server and have the server commit them in the database. Reference, for example, this thread and read what Jasper and Sebastiaan (both Mendix employees) have to say on this topic. Even though it's an old thread, the information is still relevant today: object ID's still have meaning and are reference from other tables, and you are likely to mess that up if you insert data directly into the database.
Rom van Arendonk
You are very likely to corrupt the Mendix-database, but in fact you can add data to a Mendix database directly via your database connector and if you generate the Mendix-specific id correctly, and no other entries are commited at the same time, then you are fine. The Mendix id starts with a table-id (first couple of 8 characters or so) then a record id. You will have to figure that out first. I think you are better of following Rom’s advice.
Tim v Steenbergen
You replace the Webservice with a Databse connector, so that you can query directly on your external DB, right? Is that db a Mendix fed db?
Actually doesnt matter that much;
1 – your result set of the db connector will give the desired data, you need to fetch that data to your Mx Domain Model object by generating a new Mx object to persist in (so there will be generated a new ID for that object) – assuming that the resultset is not the end object to persist in-
What is your concern anyway? If you do mapping to Mx domain model, in general speaking, you don't have to worry about dbsynchronisation and id's.