Permissions error when creating an entity

When I create a new registry, the system shows me a permissions error. Try to make the settings exposed in the thread, but still fail. The funny thing is that the record if it’s created.


Caused by: com.haulmont.cuba.core.global.EntityAccessException: Unable to load entity because it has been deleted or access denied
at com.haulmont.cuba.client.sys.DataManagerClientImpl.reload(DataManagerClientImpl.java:89)
at com.haulmont.cuba.client.sys.DataManagerClientImpl.reload(DataManagerClientImpl.java:74)
at com.haulmont.cuba.client.sys.DataManagerClientImpl.reload(DataManagerClientImpl.java:69)
at com.haulmont.cuba.gui.data.impl.GenericDataSupplier.reload(GenericDataSupplier.java:45)
at com.iis.izzy.web.common.department.DepartmentBrowse.cancel(DepartmentBrowse.java:160)
... 63 more

Model


@NamePattern("%s|name")
@Table(name = "IISCF_DEPARTMENT", uniqueConstraints = {
    @UniqueConstraint(name = "IDX_IIS_DEPARTMENT_UNQ", columnNames = {"IDENTIFICATION", "COUNTRY_ID"})
})
@Entity(name = "iis$Department")
public class Department extends Tracking {
    private static final long serialVersionUID = 3601370893447314579L;

    @Column(name = "IDENTIFICATION", nullable = false, length = 5)
    private String identification;

    @Column(name = "NAME", nullable = false, length = 80)
    private String name;

    @Lookup(type = LookupType.DROPDOWN, actions = {"lookup"})
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "COUNTRY_ID")
    private Country country;

    @Column(name = "INACTIVE", nullable = false)
    private Boolean inactive = false;

I attached the view. The code in DepartmentBrowse is the standard generated by studio.

Selección_003

Selección_004

1 Like

Hi,

Could you attach source code of DepartmentBrowse.cancel(DepartmentBrowse.java:160) ? It seems that you reload removed entity. It would be great if you attach a small demo project that illustrates the issue.

Attached used classes and view. The code for the CountryBrowse and DepartmentBrowse classes is the standard generated by Studio with behavioral modifications.

department.zip (9.1K)

Why does your code contain this line in save method: ?


departmentCollectionDs.setItem(new Department())

Hi Yuriy, I’m sorry I had not seen the line. My apologies for wasting your time. Corrected the line solved the problem.


departmentDs.setItem(new Department());