Data tools -- data models error in joinColumns?

Hi everyone, i was testing the data tools – data model but i got an error

java.lang.IllegalStateException: Annotation ‘JoinColumn’ is not present on field: ‘A.b’
at io.jmix.datatools.datamodel.DataModelRegistry.getAnnotation(DataModelRegistry.java:606) ~[jmix-datatools-3.0.1.jar:na]
at io.jmix.datatools.datamodel.DataModelRegistry.addManyToOneAttribute(DataModelRegistry.java:293) ~[jmix-datatools-3.0.1.jar:na]
at io.jmix.datatools.datamodel.DataModelRegistry.createEntityDescription(DataModelRegistry.java:171) ~[jmix-datatools-3.0.1.jar:na]
at io.jmix.datatools.datamodel.DataModelRegistry.constructDataModel(DataModelRegistry.java:141) ~[jmix-datatools-3.0.1.jar:na]
at io.jmix.datatools.datamodel.DataModelRegistry.init(DataModelRegistry.java:128) ~[jmix-datatools-3.0.1.jar:na]
at io.jmix.datatools.datamodel.DataModelRegistry.checkInitialized(DataModelRegistry.java:114) ~[jmix-datatools-3.0.1.jar:na]
at io.jmix.datatools.datamodel.DataModelRegistry.getDataModels(DataModelRegistry.java:563) ~[jmix-datatools-3.0.1.jar:na]
at io.jmix.datatoolsflowui.view.datamodel.DataModelListView.getDataModelProvider(DataModelListView.java:141) ~[jmix-datatools-flowui-3.0.1.jar:na]
at io.jmix.datatoolsflowui.view.datamodel.DataModelListView.initDataStoreNames(DataModelListView.java:129) ~[jmix-datatools-flowui-3.0.1.jar:na]
at io.jmix.datatoolsflowui.view.datamodel.DataModelListView.onInit(DataModelListView.java:119) ~[jmix-datatools-flowui-3.0.1.jar:na]
at com.vaadin.flow.component.ComponentEventBus.fireEventForListener(ComponentEventBus.java:242) ~[flow-server-25.1.7.jar:25.1.7]
at com.vaadin.flow.component.ComponentEventBus.fireEvent(ComponentEventBus.java:231) ~[flow-server-25.1.7.jar:25.1.7]
at com.vaadin.flow.component.Component.fireEvent(Component.java:412) ~[flow-server-25.1.7.jar:25.1.7]
at com.vaadin.flow.component.ComponentUtil.fireEvent(ComponentUtil.java:503) ~[flow-server-25.1.7.jar:25.1.7]
at io.jmix.flowui.view.ViewControllerUtils.lambda$fireEvent$1(ViewControllerUtils.java:221) ~[jmix-flowui-3.0.1.jar:na]
at io.jmix.flowui.observation.UiObservationSupport.lambda$observeViewLifecycle$2(UiObservationSupport.java:206) ~[jmix-flowui-3.0.1.jar:na]
at io.jmix.flowui.monitoring.LegacyUiTimerSupport.recordViewTimer(LegacyUiTimerSupport.java:101) ~[jmix-flowui-3.0.1.jar:na]

Where A has a m2o relationship with B and B has a multiple key with the “@Embeddedid” .

Hi Federico,

Thank you for reporting this!

This is a known issue: jmix#5534 — Data Model view fails for entities with a composite foreign key via JoinColumns.

The Data Models view didn’t handle @ManyToOne associations mapped with multiple join columns (@JoinColumns), which is exactly your case with the reference to an entity having @EmbeddedId. Since @JoinColumn is a repeatable annotation, declaring several of them wraps them into the @JoinColumns container, and the previous implementation failed to find the annotation on the field and threw Annotation 'JoinColumn' is not present on field.

The issue has already been fixed, and the fix is included in the release_3_0 branch, so it will be available in the next patch release — Jmix 3.0.2. After updating, the Data Models view will correctly display attributes with composite foreign keys.

Until then, the only workaround is to avoid opening the Data Models view in a project containing such a mapping — the rest of the application is not affected by this issue.

Regards,
Pavel

1 Like