I am using Studio plugin 7, I am trying to insert a row into database programmatically, I have tried the following code:
@Inject
private Metadata metadata;
@Inject
private Persistence persistence;
try (Transaction tx = persistence.createTransaction()) {
Customer customer = metadata.create(Customer.class);
customer.setName("John Smith");
persistence.getEntityManager().persist(customer);
tx.commit();
}
intellij cannot find the interface com.haulmont.cuba.core.Persistence
to import it, intellij imports a wrong package javax.persistence.Persistence
.
Anyone has any idea for why that package is not included in the project, and how to include it?
Than you