- All Known Implementing Classes:
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface EntityNameResolverAn object capable of determining the entity name for a given entity instance.
A single Java class may be mapped as an entity multiple times, with each mapping distinguished by a distinct entity name. This is not currently possible using annotations, but it may be achieved using XML-based mappings. If a class is mapped multiple times, Hibernate needs a way to determine which entity is represented by a given instance of the class. There are two ways to provide this information:
- by passing the entity name explicitly to methods of
Session, for example, by calling
Session.persist(String, Object), but this can be verbose and lacking in typesafety, or
- by having the entity instance itself carry around the information, for
example, by giving it a field holding the entity name, and supplying an
EntityNameResolverwhich is capable of extracting the information from the entity instance.