3.8.9.2.2. Nonpolymorphic
All fields in Java are polymorphic.
If you declare a field of type T, you can assign any subclass of T to the field as well.
This is very convenient, but can make relation traversal very inefficient under some inheritance strategies.
It can even make querying across the field impossible.
Often, you know that certain fields do not need to be entirely polymorphic.
By telling OpenJPA about such fields, you can improve the efficiency of your relations.
|
|
OpenJPA also includes the |
OpenJPA defines the following extensions for nonpolymorphic values:
The value of these extensions is a constant from the
org.apache.openjpa.persistence.jdbc.NonpolymorphicType
enumeration.
The default value, EXACT, indicates that the relation will always be of the exact declared type.
A value of JOINABLE, on the other hand, means that the relation might be to any joinable subclass of the declared type.
This value only excludes table-per-class subclasses.