Package org.hibernate.engine.spi
Interface ManagedEntity
- All Superinterfaces:
Managed
,PrimeAmongSecondarySupertypes
Specialized
Managed
contract for entity classes. Essentially provides access to information
about an instance's association to a Session/EntityManager. Specific information includes:-
the association's
EntityEntry
(by way of$$_hibernate_getEntityEntry()
and$$_hibernate_setEntityEntry(org.hibernate.engine.spi.EntityEntry)
). EntityEntry describes states, snapshots, etc. -
link information. ManagedEntity instances are part of a "linked list", thus link information
describes the next and previous entries/nodes in that ordering. See
$$_hibernate_getNextManagedEntity()
,$$_hibernate_setNextManagedEntity(org.hibernate.engine.spi.ManagedEntity)
,$$_hibernate_getPreviousManagedEntity()
,$$_hibernate_setPreviousManagedEntity(org.hibernate.engine.spi.ManagedEntity)
-
Method Summary
Modifier and TypeMethodDescriptionProvides access to the associated EntityEntry.Obtain a reference to the entity instance.Part of entry linking; obtain reference to the next entry.Part of entry linking; obtain reference to the previous entry.void
$$_hibernate_setEntityEntry
(EntityEntry entityEntry) Injects the EntityEntry associated with this entity instance.void
Part of entry linking; sets the next entry.void
Part of entry linking; sets the previous entry.void
$$_hibernate_setUseTracker
(boolean useTracker) Used to understand if the tracker can be used to detect dirty properties.boolean
Can the tracker be used to detect dirty attributesdefault ManagedEntity
Special internal contract to optimize type checkingMethods inherited from interface org.hibernate.engine.spi.PrimeAmongSecondarySupertypes
asCompositeOwner, asCompositeTracker, asHibernateProxy, asManagedComposite, asManagedMappedSuperclass, asPersistentAttributeInterceptable, asProxyConfiguration, asSelfDirtinessTracker
-
Method Details
-
$$_hibernate_getEntityInstance
Object $$_hibernate_getEntityInstance()Obtain a reference to the entity instance.- Returns:
- The entity instance.
-
$$_hibernate_getEntityEntry
EntityEntry $$_hibernate_getEntityEntry()Provides access to the associated EntityEntry.- Returns:
- The EntityEntry associated with this entity instance.
- See Also:
-
$$_hibernate_setEntityEntry
Injects the EntityEntry associated with this entity instance. The EntityEntry represents state associated with the entity in regards to its association with a Hibernate Session.- Parameters:
entityEntry
- The EntityEntry associated with this entity instance.
-
$$_hibernate_getPreviousManagedEntity
ManagedEntity $$_hibernate_getPreviousManagedEntity()Part of entry linking; obtain reference to the previous entry. Can benull
, which should indicate this is the head node.- Returns:
- The previous entry
-
$$_hibernate_setPreviousManagedEntity
Part of entry linking; sets the previous entry. Again, can benull
, which should indicate this is (now) the head node.- Parameters:
previous
- The previous entry
-
$$_hibernate_getNextManagedEntity
ManagedEntity $$_hibernate_getNextManagedEntity()Part of entry linking; obtain reference to the next entry. Can benull
, which should indicate this is the tail node.- Returns:
- The next entry
-
$$_hibernate_setNextManagedEntity
Part of entry linking; sets the next entry. Again, can benull
, which should indicate this is (now) the tail node.- Parameters:
next
- The next entry
-
$$_hibernate_setUseTracker
void $$_hibernate_setUseTracker(boolean useTracker) Used to understand if the tracker can be used to detect dirty properties.@Entity class MyEntity{ @Id Integer id String name } inSession ( session -> { MyEntity entity = new MyEntity(1, "Poul"); session.persist(entity); }); inSession ( session -> { MyEntity entity = new MyEntity(1, null); session.merge(entity); });
Because the attribute `name` has been set to null the SelfDirtyTracker does not detect any change and so doesn't mark the attribute as dirty so the merge does not perform any update.- Parameters:
useTracker
- true if the tracker can be used to detect dirty properties, false otherwise
-
$$_hibernate_useTracker
boolean $$_hibernate_useTracker()Can the tracker be used to detect dirty attributes- Returns:
- true if the tracker can be used to detect dirty properties, false otherwise
-
asManagedEntity
Special internal contract to optimize type checking- Specified by:
asManagedEntity
in interfacePrimeAmongSecondarySupertypes
- Returns:
- this same instance
- See Also:
-