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” .
Any ideas?
@JmixEntity @Table(name = “ESCUELA”) @Entity
public class Escuela { @JmixGeneratedValue @Column(name = “ID”, nullable = false) @Id
private UUID 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 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 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:
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.
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.
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 Dmitriy
Many thanks! I am glad a solution was found.
I was experiencing the same problem with projects up to version 2.7.6 without the tabs add-on , but I am unable to reproduce the issue now, maybe the latest update to jmix studio solved it? The difference was that I was able to bypass the error in projects without the add-on, by doing a Manual build of the project after creating the entity and before debugging. Not sure why this worked.
I haven’t tried to reproduce it in framework 2.8 yet.