The DataManager#save(java.lang.Object...) method is one of the most frequently used methods of the DataManager component. Most Jmix projects end up calling it many times. However, there’s an important detail: this method reloads the entities being saved, which is not always useful.
At the same time, a separate FetchPlan is generated for each entity based on the state of its fields at the time of saving, and each entity is reloaded individually. Therefore, saving 100 objects results in 100 additional reload queries (and potentially more, depending on entity complexity and the selected FetchPlan). What’s more, this process goes through the full ORM stack, including entity lifecycle events triggered during loading.
If you want to avoid reloading entities, you can use the overloaded save() method that accepts a SaveContext and enable the setDiscardSaved(true) option.
Not exactly convenient, is it? That’s why, starting with version 2.6, save(Object...) has a “twin” method:
void saveWithoutReload(Object... entities);
From its name and signature, it’s clear that this method is the more efficient choice when you need to save entities but don’t need to reload them afterwards. In many cases, it can significantly reduce load on the application server, the database, and the network.
Let’s compare the code you’d write using SaveContext with the new method. Using SaveContext:
dataManager.save(new SaveContext()
.saving(entity1,entity2)
.setDiscardSaved())
You have to admit, the following code looks much nicer:
dataManager.saveWithoutReload(entity1, entity2);
The main advantage isn’t fewer lines of code, but an explicit choice of API method: whether you want the entities reloaded and returned after saving. This also lowers the risk of unfortunate mistakes.

On the one hand, it’s fair to say the change looks minor. But most performance problems come from database interactions, and finding and fixing them at the latest stages in the project is time-consuming and expensive. That’s why even a seemingly minor adjustment can save significant time and effort, while also improving the quality of the end product.

