Deprecated
since 6.2.
This annotation is hardly ever useful.
@Polymorphism(type=EXPLICIT).
Hibernate allows a query from clause to name a
mapped superclass, or even an arbitrary Java type which
is neither an entity class nor a mapped superclass. The
query will return all entities which inherit the type.
For example, the query
from java.lang.Object
will return every entity mapped by Hibernate!
This can be thought of as allowing a sort of "poor man's" table per class inheritance, though it comes with many limitations.
This annotation allows an entity class to refuse to participate in such a crazy query, so that it's never returned by any query that names one of its non-entity supertypes.
Note that this annotation may only be applied to the root entity in an entity inheritance hierarchy, and its effect is inherited by entity subclasses.
Note also that this has no effect at all on the usual polymorphism within a mapped entity class inheritance hierarchy, as defied by the JPA specification. "Implicit" polymorphism is about queries that span multiple such entity inheritance hierarchies.
| Modifier and Type | Method and Description |
|---|---|
| public PolymorphismType | type()
Deprecated
as a consequence of
Determines whether implicit polymorphism is enabled
or disabled for the annotated entity class.
PolymorphismType being deprecated.
|
| type | back to summary |
|---|---|
| public PolymorphismType type()
Deprecated as a consequence of Determines whether implicit polymorphism is enabled or disabled for the annotated entity class. It is enabled by default. | |