بنقرة واحدة
jmix-create-service
Create Jmix service-layer business logic with DataManager, transactions, and no UI coupling.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Create Jmix service-layer business logic with DataManager, transactions, and no UI coupling.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Open a Jmix entity detail view from a button/action and refresh related data after save.
Add Jmix entity lifecycle event listeners to perform additional actions with saved or loaded entities.
Add complete Jmix message keys for entities, enums, views, actions, and validation text.
Configure or audit Jmix fetch plans in XML views, fragments, DataManager loads, repositories, and entity events when loading references, avoiding N+1 queries, fixing unfetched attribute errors, or tuning data loading.
Add inline editable parent-child composition UI to a Jmix detail view, when a parent entity owns child records edited via a property-bound collection container (no query loader).
Create a Jmix Flow UI detail view with XML descriptor, save-close action, messages, and policies.
| name | jmix-create-service |
| description | Create Jmix service-layer business logic with DataManager, transactions, and no UI coupling. |
Use this skill when implementing business operations, calculations, or persistence workflows.
@Service in the service package.DataManager for normal loading and saving.@Transactional when the operation changes multiple entities or must be atomic.import io.jmix.core.DataManager;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.UUID;
@Service
public class AccountService {
private final DataManager dataManager;
public AccountService(DataManager dataManager) {
this.dataManager = dataManager;
}
@Transactional
public Account applyDelta(UUID accountId, int delta) {
Account account = dataManager.load(Account.class)
.id(accountId)
.one();
account.setBalance(account.getBalance() + delta);
account.setLastUpdated(LocalDateTime.now());
return dataManager.save(account);
}
}
Consume the instance RETURNED by dataManager.save(...): the pre-save argument is stale (no generated id/version), while save(...) returns the fresh managed copy. A missing transaction boundary and using the stale argument are both compile- and render-clean defects.
Customer customer = dataManager.load(Customer.class)
.id(customerId)
.one();
List<Customer> activeCustomers = dataManager.load(Customer.class)
.query("select e from Customer e where e.active = true")
.list();
io.jmix.core.EntityStates#isNew(entity).DataManager does more than load/save: loadValues() for scalar/aggregate data, the Condition API (PropertyCondition / LogicalCondition) as a JPQL alternative, pessimistic lockMode(), and hard delete by setting the PersistenceHints.SOFT_DELETION hint to false (e.g. saveContext.setHint(PersistenceHints.SOFT_DELETION, false)).EntityManager for regular CRUD.Verify any unfamiliar Jmix/Vaadin symbol before typing it (jmix-verify-api-symbol), then run the gates after writing the service: static checks (jmix-ide-static-analysis) and the context-load test (jmix-verify-bootrun).