Warning - cannot be null

Hello, I am having problems with the Entity Inspector. I have created an entity named ESCUELA with two fields: rbd and name. Both are required. When I go to entity inspector for escuela, these two fields are shown, as expected but when I press save I get an error. It’s in Spanish but it means “warning , cannot be null” .
Screenshot 2025-07-10 at 8.06.59 PM

Any ideas?

@JmixEntity
@Table(name = “ESCUELA”)
@Entity
public class Escuela {
@JmixGeneratedValue
@Column(name = “ID”, nullable = false)
@Id
private UUID id;

@Column(name = "VERSION", nullable = false)
@Version
private Integer version;

@CreatedBy
@Column(name = "CREATED_BY")
private String createdBy;

@CreatedDate
@Column(name = "CREATED_DATE")
private OffsetDateTime createdDate;

@LastModifiedBy
@Column(name = "LAST_MODIFIED_BY")
private String lastModifiedBy;

@LastModifiedDate
@Column(name = "LAST_MODIFIED_DATE")
private OffsetDateTime lastModifiedDate;

@DeletedBy
@Column(name = "DELETED_BY")
private String deletedBy;

@DeletedDate
@Column(name = "DELETED_DATE")
private OffsetDateTime deletedDate;

@Column(name = "RBD", nullable = false, length = 7)
@NotNull
private String rbd;

@InstanceName
@Column(name = "NOMBRE", nullable = false)
@NotNull
private String nombre;

public String getNombre() {
    return nombre;
}

public void setNombre(String nombre) {
    this.nombre = nombre;
}

public String getRbd() {
    return rbd;
}

public void setRbd(String rbd) {
    this.rbd = rbd;
}

public OffsetDateTime getDeletedDate() {
    return deletedDate;
}

public void setDeletedDate(OffsetDateTime deletedDate) {
    this.deletedDate = deletedDate;
}

public String getDeletedBy() {
    return deletedBy;
}

public void setDeletedBy(String deletedBy) {
    this.deletedBy = deletedBy;
}

public OffsetDateTime getLastModifiedDate() {
    return lastModifiedDate;
}

public void setLastModifiedDate(OffsetDateTime lastModifiedDate) {
    this.lastModifiedDate = lastModifiedDate;
}

public String getLastModifiedBy() {
    return lastModifiedBy;
}

public void setLastModifiedBy(String lastModifiedBy) {
    this.lastModifiedBy = lastModifiedBy;
}

public OffsetDateTime getCreatedDate() {
    return createdDate;
}

public void setCreatedDate(OffsetDateTime createdDate) {
    this.createdDate = createdDate;
}

public String getCreatedBy() {
    return createdBy;
}

public void setCreatedBy(String createdBy) {
    this.createdBy = createdBy;
}

public Integer getVersion() {
    return version;
}

public void setVersion(Integer version) {
    this.version = version;
}

public UUID getId() {
    return id;
}

public void setId(UUID id) {
    this.id = id;
}

update: So I re created the entity only with id, rbd and name and same error from Entity Inspector:

@JmixEntity
@Table(name = “ESCUELA”)
@Entity
public class Escuela {
@JmixGeneratedValue
@Column(name = “ID”, nullable = false)
@Id
private UUID id;

@Column(name = "RBD", nullable = false, length = 7)
@NotNull
private String rbd;

@InstanceName
@Column(name = "NOMBRE", nullable = false)
@NotNull
private String nombre;

public String getNombre() {
    return nombre;
}

public void setNombre(String nombre) {
    this.nombre = nombre;
}

public String getRbd() {
    return rbd;
}

public void setRbd(String rbd) {
    this.rbd = rbd;
}

public UUID getId() {
    return id;
}

public void setId(UUID id) {
    this.id = id;
}

}

EDIT 2: When I disable MANDATORY for both fields it works and no more errors. In both scenarios I made sure data was entered in both fields so I am still wondering why this happens.

Hi!

Unfortunately, I can’t reproduce your problem.

There is the code for my TestEntity entity:

@JmixEntity
@Table(name = "TEST_ENTITY")
@Entity
public class TestEntity {
    @JmixGeneratedValue
    @Column(name = "ID", nullable = false)
    @Id
    private UUID id;

    @NotNull
    @InstanceName
    @Column(name = "NAME", nullable = false)
    private String name;

    @NotNull
    @Column(name = "TEST_PROPERTY", nullable = false, length = 7)
    private String testProperty;

    public String getTestProperty() {
        return testProperty;
    }

    public void setTestProperty(String testProperty) {
        this.testProperty = testProperty;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public UUID getId() {
        return id;
    }

    public void setId(UUID id) {
        this.id = id;
    }

}

I can save my entity without any warnings:
Screen Recording 2025-07-11 at 10.15.43

Could you please provide a small test project that reproduces the problem?

Best regards,
Dmitriy

HI Dmitriy, I came back to this post because I am facing the same issue with Jmix 2.7.6.
I am attaching a test project that is having the problem.

When working with a project without tabbed mode, I am able to bypass the error by doing a MANUAL BUILD of the project before running it (dont know why this solution works?)
but this solution isnt working with a project with Tabbed mode.

Claude Code did some analysis and it says this:

“The issue is that the @NotNull Bean Validation annotations on the entity fields interfere with the Entity Inspector. When it creates a new entity instance (before you fill in the fields), it validates the whole entity and fails because the fields are momentarily null.” “Jmix’s Entity Inspector instantiates a new empty entity object before you fill in any fields. The @NotNull Bean Validation runs against that empty instance and throws the error immediately, even though you’re about to provide values.”

Then it went deeper:

"Found the root cause. It’s a confirmed incompatibility between jmix-tabbedmode and jmix-datatools.
Here’s the exact sequence in your Tabbed Mode app when clicking “Create” in Entity Inspector:
Step 1 — Tabbed Mode’s DetailViewBuilderProcessor.build() calls detailView.setEntityToEdit(entityA) (from the newEntitySupplier). This merges Entity A (null fields) into the view’s DataContext.
Step 2 — Views.open() then calls sendNavigationEvent() because the route parameters (entityName=Escuela, entityId=new) are present. This fires processBeforeEnterInternal on the view, which calls EntityInspectorDetailView.setupEntityToEdit(“new”) → createNewItemByMetaClass(), creating Entity B via dataContext.create(). Entity B ends up in the container and the form binds to it.
Step 3 — The user fills in the form (updating Entity B). Both Entity A (null fields) and Entity B (user values) are in the DataContext.
Step 4 — dataContext.save() persists both:

Entity A → INSERT with all-null fields → DB constraint fires (or, with @NotNull, EclipseLink runs Bean Validation first → ConstraintViolationException)

Entity B → INSERT with user values → would succeed, but the transaction already failed
The @NotNull annotations are irrelevant to the fix. The real problem is the double entity creation caused by jmix-tabbedmode triggering two separate setEntityToEdit calls on the EntityInspectorDetailView.
Summary: This is a bug in the integration of jmix-tabbedmode 2.7.6 with jmix-datatools — the Entity Inspector was not designed to work with Tabbed Mode’s navigation interception. "

I uploaded the test project to WeTransfer: Unique Download Link | WeTransfer

Screenshot 2026-03-30 at 2.37.01 PM

Hi!

Thanks for the test project.

I couldn’t reproduce your problem even with the test project you provided. My failure may be due to the fact that I changed the database configuration to HSQLDB to run the project.

Offtop:

  1. To avoid publishing a large archive on a third-party file-sharing service, you can use the zipProject gradle task. It compresses the project without unnecessary files. The archive can then be uploaded directly to a forum post.
    image
  2. I couldn’t run your project in its configuration because it has a Postgres database configured as its data source. I don’t have the same database schema as your environment. If you want to share the project along with the database, you need to use HSQLDB in file.

Best regards,
Dmitriy

Hi Dmitriy, thanks for your response.

Here’s a new project, with the HSQLDB included. The problem persists.
test_project.zip (118.9 KB)
try creating a Escuela record through Entity Inspector. The popup appears “may not be null”

Hi!

Thank you for test project! I was able to reproduce the issue.
I have created an issue to fix the bug in the Jmix 2.8.1 release: Entity Inspector can't save new entity with mandatory attributes for TabbedMode · Issue #5182 · jmix-framework/jmix · GitHub

If you need a fix urgently, you can override the EntityInspectorDetailView in your application and add the following code to the controller:

    @Override
    protected void setupEntityToEdit(Object entityToEdit) {
        container = initMainContainer(entityToEdit);
        isNew = entityStates.isNew(entityToEdit);
    }

Best regards,
Dmitriy