Description
For an entity relation where the looked up entity does not exist, there are 3 possible ways to handle this:
(1) fail
(2) consider the looked up entity as not strictly required to be resolvable and render a (none) badge
(3) render a pseudo entity, that has the information, which primary or secondary lookup key could not be resolved and perhaps render in a different/warning color say
Re (3) such a pseudo entity needs to be bookmarkable, hence would be appropriate to implement as viewmodel.
class MyEntityNotFound extends MyEntity implements ViewModel { public MyEntityNotFound (final String memento) { setName(memento); } @Override public String viewModelMemento() { return getName(); } }