Interface EnhancementModel
- All Known Implementing Classes:
DefaultEnhancementModel
Describes the persistence semantics of classes and fields without defining
application classes. An EnhancementSession combines this model with an
EnhancementEnvironment and resolves discovered types, including implicit
embeddables. The model itself does not own discovery results or bytecode caches.
Model decisions describe persistent state independently of whether an enhancer
generates support for a particular feature. For example, a lazy attribute remains
lazy in the model when EnhancementOptions.doLazyInitialization() is false.
Implementations must provide stable decisions for a session's lifetime and
support concurrent queries when the session is used concurrently. A model may
be reused with different environments; resolved metadata is session-specific.
DefaultEnhancementModel supplies Hibernate's annotation-based defaults.
- Since:
- 8.0
-
Method Summary
Modifier and TypeMethodDescriptionInitial classes whose managed enhancement is planned by the integration.booleanbooleanIdentifies explicitly known embeddables.booleanisEntityClass(UnloadedClass type) booleanisLazyLoadable(UnloadedField field) booleanisMappedCollection(UnloadedField field) Distinguishes persistent plural attributes from collection-valued basic attributes when the enhancer handles a collection-typed field.booleanbooleanisPersistentField(UnloadedField field) Determines persistent-field eligibility after the enhancer has excluded static fields and its generated implementation fields.order(UnloadedField[] fields) Orders persistent fields consistently with the model's attribute ordering.
-
Method Details
-
getCandidates
Initial classes whose managed enhancement is planned by the integration. Sessions snapshot these names and may discover additional embedded types and mapped superclasses. Merely referencing another entity does not schedule it.- Returns:
- binary class names, using dots rather than JVM internal-name slashes;
empty by default, allowing explicit
EnhancementSession.discoverTypes(String, byte[])calls to supply candidates
-
isEntityClass
- Parameters:
type- an unloaded class descriptor- Returns:
- whether the class is an entity within this model
-
isCompositeClass
Identifies explicitly known embeddables. Session discovery additionally recognizes types used as embedded attributes, even without an embeddable annotation.- Parameters:
type- an unloaded class descriptor- Returns:
- whether the model explicitly recognizes an embeddable class
-
isMappedSuperclassClass
- Parameters:
type- an unloaded class descriptor- Returns:
- whether the class supplies persistent state as a mapped superclass
-
isPersistentField
Determines persistent-field eligibility after the enhancer has excluded static fields and its generated implementation fields.- Parameters:
field- an unloaded field descriptor- Returns:
- whether the field represents persistent state
-
order
Orders persistent fields consistently with the model's attribute ordering. Implementations may reorder the supplied array in place. A replacement array must preserve its runtime component type and contain the supplied descriptors.- Parameters:
fields- the eligible persistent fields- Returns:
- those fields in model order
-
hasLazyLoadableAttributes
- Parameters:
type- an unloaded class descriptor- Returns:
- whether the model permits lazy attributes in this class, independently of whether lazy-loading support is enabled in the enhancement options
-
isLazyLoadable
- Parameters:
field- an unloaded persistent-field descriptor- Returns:
- whether the attribute may be loaded lazily under this model
-
isMappedCollection
Distinguishes persistent plural attributes from collection-valued basic attributes when the enhancer handles a collection-typed field.- Parameters:
field- an unloaded persistent-field descriptor- Returns:
- whether the field should receive persistent-collection handling
-