Insert in Cuba 7

How can I perform insert programmatically in Cuba 7?

In Cuba 6 this is done as below:

Customer newCustomer = metadata.create(Customer.class);
newCustomer.setCustomerType(customerToCopy.getCustomerType());
customersDs.addItem(newCustomer);
customersDs.commit();

Regards,
-n

Hi, @neutrino!

I can advise you to use the following example:

Customer newCustomer = metadata.create(Customer.class);
newCustomer.setCustomerType(customerToCopy.getCustomerType());
dataManager.commit(newCustomer); // saves newCustomer entity to database

I put a link to the documentation about DataManager.

Regards,
Gleb

1 Like