Top Description Methods
org.hibernate.annotations

public @Interface Polymorphism

extends Annotation
Annotations
@Deprecated
since:6.2
@Target:TYPE
@Retention:RUNTIME
Imports
java.lang.annotation.Retention, .Target

Deprecated

since 6.2.

This annotation is hardly ever useful.

Allows implicit polymorphism to be disabled for an entity class hierarchy, by annotating the root entity @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.

Author
Steve Ebersole

Method Summary

Modifier and TypeMethod and Description
public PolymorphismType
type()

Deprecated as a consequence of PolymorphismType being deprecated.
Determines whether implicit polymorphism is enabled or disabled for the annotated entity class.
Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

typeback to summary
public PolymorphismType type()

Deprecated

as a consequence of PolymorphismType being deprecated. See corresponding docs for further information.

Determines whether implicit polymorphism is enabled or disabled for the annotated entity class. It is enabled by default.