Hibernate provides the annotation @NotFound.  This annotation can be used in cases where we have relationships between the Entities e.g. ManyToOne or OneToMany or ManyToMany etc.

Syntax - @NotFound(action=NotFoundException.IGNORE)

When we want to access an entity using the relation from another entity, if the value of this entity is not available then the hibernate throws an exception. We  can use @NotFound annotation to ignore these exceptions. NotFoundException.IGNORE tells the hibernate to avoid throwing the exception if the record for the entity is not found.

public class User{