import entity with timestamp

Hi

I want to import records from an old database with a different structure than cuba.
My algorithm is to read every row and for each one to create an entity, set values and commit it.
Example

Customer myCustomer = metadata.create(Customer.class);
myCustomer.setName(column1);
myCustomer.setCreateTs(column2);
myCustomer.setUpdateTs(column3);
//etc
 commitContext.addInstanceToCommit(myCustomer, "customer-view");
dataManager.commit(commitContext);

the problem is that the values CreateTs and UpdateTs and user are not the ones I set, the entity saves with the current time and user

dataManager.commit overwrites this values for new entities?
Thank you

Hi George,

Unfortunately, you cannot set arbitrary values to system fields when working with DataManager or EntityManager. The only way to do it is to write to the database directly via JDBC, for example using QueryRunner (see its update() method). You can do it after creating each instance via DataManager, by running an additional SQL update for the system fields.

Thank you Konstantin
your suggestion is my original plan, I just wanted to make sure there is no other way
Kind regards