Feature Request: REST DataStore & Dynamic Attributes

Hi Jmix Team,

Konstantin, thank you for your earlier clarification regarding REST DataStore.

I would like to kindly suggest enhancing REST DataStore to support fetching entities along with their dynamic attributes. This feature would greatly simplify cross-service communication and improve flexibility when working with entities in distributed systems.

I understand that this may require planning, but any consideration or guidance on potential future support would be highly appreciated.

Warm regards,
Naveen

Hi Naveen,

Could you please tell us more about your use case? How do you use REST DataStore and Dynamic Attributes in your application?

This will help us choose the right direction.

Regards,
Konstantin

Hi Konstantin,

Thank you for your response.

In our setup, we have two Jmix applications: APP-A and APP-B. APP-A contains the Pet entity with Dynamic Attributes enabled, and APP-B accesses this data using REST DataStore.

For CRUD operations, APP-A publishes the Pet UUID via RabbitMQ, and APP-B consumes the message and retrieves the Pet record from APP-A using that UUID.

The entity is retrieved successfully in APP-B, but the Dynamic Attributes are not included in the response—only the standard fields are returned. However, when we make a direct REST API call with ?dynamicAttributes=true, the Dynamic Attributes are returned correctly.

Could you please advise if there is a recommended way or workaround to retrieve Dynamic Attributes when using REST DataStore?

Kind regards,
Naveen

Ok, thanks.
But how are you going to use the dynamic attributes of the Pet entity in APP-B?
Do you need to show them in UI? The problem is the Dynamic Attributes add-on allows you to configure dynamic attributes only for JPA entities, while Pet in APP-B is a DTO.

Hi Konstantin,

Thank you for the clarification regarding Dynamic Attributes. In APP-B, the Pet object is a DTO, and since the Dynamic Attributes add-on works only with JPA entities, we plan to handle them using a Map<String, Object> within the DTO.

This approach allows us to:

  • Keep the DTO decoupled from JPA and persistence logic.
  • Flexibly store any type of dynamic attribute (String, Number, Boolean, etc.).
  • Use the attributes for data transfer between services (we are not displaying them in the Vaadin UI in APP-B).
  • Synchronize updates back to the JPA entity in APP-A for persistence.

Using a defensive copy ensures that changes in the DTO do not affect the entity until they are explicitly saved. We believe this approach provides a clean and maintainable way to work with dynamic attributes in a cross-application context.

We would greatly appreciate any feedback or recommendations you might have regarding this approach.

Best regards,
M. Naveen

Hi Naveen,

To load the dynamic attributes of the server-side entity to a map in the client-side DTO you could use the entity events on the client side. So the REST DataStore loads the DTO, and then you repeat the request to the REST API with dynamicAttributes=true and populate the map.

I understand that it’s not the best solution from the performance perspective. We’ll think how to make the REST DataStore more flexible in the future: see Add extension points to REST DataStore loading/saving flow · Issue #5142 · jmix-framework/jmix

Regards,
Konstantin