Back to list
TorbenMerrald

jmix-soft-deletion

by TorbenMerrald

Equine care management platform for stables - track horses, vaccinations, worm tests, treatments, and automated notifications

1🍴 0📅 Jan 10, 2026

SKILL.md


name: Jmix Soft Deletion description: Work with soft-deleted entities in Jmix applications. Use this skill when implementing features that need to show or hide soft-deleted records. Use this skill when bypassing soft deletion filtering to include deleted entities in queries. Use this skill when working with @DeletedDate and @DeletedBy annotations. Use this skill when implementing "show deleted" toggles in list views.

Jmix Soft Deletion

When to use this skill

  • When implementing a toggle to show/hide soft-deleted entities in a view
  • When writing queries that need to include soft-deleted records
  • When using LoadContext hints to control soft deletion filtering
  • When working with entities that have @DeletedDate and @DeletedBy annotations
  • When implementing restore functionality for soft-deleted entities

Instructions

Entity Setup

Entities with soft delete support have these annotations:

@DeletedBy
@Column(name = "DELETED_BY")
private String deletedBy;

@DeletedDate
@Column(name = "DELETED_DATE")
private OffsetDateTime deletedDate;

Including Soft-Deleted Entities in Queries

Use PersistenceHints.SOFT_DELETION with a LoadContext or loadDelegate:

import io.jmix.data.PersistenceHints;  // IMPORTANT: NOT io.jmix.core

@Install(to = "entityDl", target = Target.DATA_LOADER)
private List<Entity> loadDelegate(LoadContext<Entity> loadContext) {
    boolean showDeleted = Boolean.TRUE.equals(showDeletedCheckbox.getValue());
    loadContext.setHint(PersistenceHints.SOFT_DELETION, !showDeleted);
    return dataManager.loadList(loadContext);
}
  • SOFT_DELETION = true (default): Filters out deleted entities
  • SOFT_DELETION = false: Includes deleted entities

Important Considerations

  1. Caching: Remove cacheable="true" from XML loaders when dynamically toggling soft deletion, as cached results may ignore hint changes.

  2. Reload on toggle: When the user toggles the show/hide deleted checkbox, call loader.load() to refresh the data:

@Subscribe("showDeletedCheckbox")
public void onShowDeletedCheckboxChange(AbstractField.ComponentValueChangeEvent<JmixCheckbox, Boolean> event) {
    entityDl.load();
}
  1. Visual distinction: Combine with vaadin-grid-styling skill to visually distinguish deleted entities (e.g., faded/gray appearance).

Score

Total Score

65/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新

+5
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon