There are situations where it is required to obtain the first persistent entity type the hierarchy for an entity type. For example, there could be an instrumented or enhanced instances of a synthetic entity that is based on persistent, and we need to get the type of that persistent entity.
EntityUtils should be provided with method Optional<Class<? extends AbstractEntity<?>>> findFirstPersistentTypeInHierarchyFor(final Class<? extends AbstractEntity<?>> entityType) that would return the first persistent entity type of the type hierarchy for its argument entityType. The returned type could be entityType itself or the first super type that represents a persistent entity. Otherwise, an empty result should be returned.
Expected outcome
A convenient way to obtain the first persistent entity type in an entity type hierarchy.
Description
There are situations where it is required to obtain the first persistent entity type the hierarchy for an entity type. For example, there could be an instrumented or enhanced instances of a synthetic entity that is based on persistent, and we need to get the type of that persistent entity.
EntityUtils
should be provided with methodOptional<Class<? extends AbstractEntity<?>>> findFirstPersistentTypeInHierarchyFor(final Class<? extends AbstractEntity<?>> entityType)
that would return the first persistent entity type of the type hierarchy for its argumententityType
. The returned type could beentityType
itself or the first super type that represents a persistent entity. Otherwise, an empty result should be returned.Expected outcome
A convenient way to obtain the first persistent entity type in an entity type hierarchy.