Is there a way to set some (default) value if the entity not found (only if the entity not found - EntityNotFound exception)? If there is a null value in DB, the field must be null. For example, I have an entity First with relationship to an entity Second:
class First {
...
@ManyToOne @JoinColumn(name="second", nullable=true)
@NotFound(action = NotFoundAction.IGNORE)
Second second;
...
}
if column "second" in DB (Table "First") is null, then first.second must be null. If column "second" in DB (Table "First") is 5 (second id = 5) and there isn't exist row in table "Second" with id == 5 then firts.second should be some default value (entity), for example entity Second with id = 1 or new Second(params);