Top Description Inners Methods
org.hibernate

public Interface CustomEntityDirtinessStrategy

Known Direct Implementers
org.hibernate.boot.internal.DefaultCustomEntityDirtinessStrategy
Imports
org.hibernate.persister.entity.EntityPersister, org.hibernate.type.Type

During a flush cycle, Hibernate needs to determine which of the entities associated with a Session. Dirty entities are the ones that get UPDATEed to the database.

In some circumstances, that process of determining whether an entity is dirty can take a significant time as by default Hibernate must check each of the entity's attribute values one-by-one. Oftentimes applications already have knowledge of an entity's dirtiness and using that information instead would be more performant. The purpose of this contract then is to allow applications such a plug-in point.

Author
Steve Ebersole

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
CustomEntityDirtinessStrategy.AttributeChecker

Responsible for identifying when attributes are dirty.

public static interface
CustomEntityDirtinessStrategy.AttributeInformation

Provides AttributeChecker with meta information about the attributes being checked.

public static interface
CustomEntityDirtinessStrategy.DirtyCheckContext

A callback to drive dirty checking.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true indicates the dirty check can be done; false indicates it cannot.
canDirtyCheck
(Object
The entity to be check.
entity
,
EntityPersister
The persister corresponding to the given entity
persister
,
Session
The session from which this check originates.
session
)

Deprecated as a consequence of Session being deprecated.
Is this strategy capable of telling whether the given entity is dirty?
public void
findDirty(Object
The entity being checked
entity
,
EntityPersister
The persister corresponding to the given entity
persister
,
Session
The session from which this call originates.
session
,
CustomEntityDirtinessStrategy.DirtyCheckContext
The callback context
dirtyCheckContext
)

Deprecated as a consequence of Session being deprecated.
Callback used to hook into Hibernate algorithm for determination of which attributes have changed.
public boolean

Returns:

true indicates the entity is dirty; false indicates the entity is not dirty.
isDirty
(Object
The entity to check.
entity
,
EntityPersister
The persister corresponding to the given entity
persister
,
Session
The session from which this check originates.
session
)

Deprecated as a consequence of Session being deprecated.
The callback used by Hibernate to determine if the given entity is dirty.
public void
resetDirty(Object
The entity to reset
entity
,
EntityPersister
The persister corresponding to the given entity
persister
,
Session
The session from which this call originates.
session
)

Deprecated as a consequence of Session being deprecated.
Callback used by Hibernate to signal that the entity dirty flag should be cleared.

Method Detail

canDirtyCheckback to summary
public boolean canDirtyCheck(Object entity, EntityPersister persister, Session session)

Deprecated

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

Is this strategy capable of telling whether the given entity is dirty? A return of true means that isDirty will be called next as the definitive means to determine whether the entity is dirty.

Parameters
entity:Object

The entity to be check.

persister:EntityPersister

The persister corresponding to the given entity

session:Session

The session from which this check originates.

Returns:boolean

true indicates the dirty check can be done; false indicates it cannot.

findDirtyback to summary
public void findDirty(Object entity, EntityPersister persister, Session session, CustomEntityDirtinessStrategy.DirtyCheckContext dirtyCheckContext)

Deprecated

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

Callback used to hook into Hibernate algorithm for determination of which attributes have changed. Applications wanting to hook in to this would call back into the given DirtyCheckContext#doDirtyChecking method passing along an appropriate AttributeChecker implementation.

Parameters
entity:Object

The entity being checked

persister:EntityPersister

The persister corresponding to the given entity

session:Session

The session from which this call originates.

dirtyCheckContext:CustomEntityDirtinessStrategy.DirtyCheckContext

The callback context

isDirtyback to summary
public boolean isDirty(Object entity, EntityPersister persister, Session session)

Deprecated

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

The callback used by Hibernate to determine if the given entity is dirty. Only called if the previous canDirtyCheck returned true

Parameters
entity:Object

The entity to check.

persister:EntityPersister

The persister corresponding to the given entity

session:Session

The session from which this check originates.

Returns:boolean

true indicates the entity is dirty; false indicates the entity is not dirty.

resetDirtyback to summary
public void resetDirty(Object entity, EntityPersister persister, Session session)

Deprecated

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

Callback used by Hibernate to signal that the entity dirty flag should be cleared. Generally this happens after previous dirty changes were written to the database.

Parameters
entity:Object

The entity to reset

persister:EntityPersister

The persister corresponding to the given entity

session:Session

The session from which this call originates.

org.hibernate back to summary

public Interface CustomEntityDirtinessStrategy.AttributeChecker


Responsible for identifying when attributes are dirty.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true indicates the attribute value has changed; false indicates it has not.
isDirty
(CustomEntityDirtinessStrategy.AttributeInformation
Information about the attribute which is useful to help determine if it is dirty.
attributeInformation
)

Do the attribute dirty check.

Method Detail

isDirtyback to summary
public boolean isDirty(CustomEntityDirtinessStrategy.AttributeInformation attributeInformation)

Do the attribute dirty check.

Parameters
attributeInformation:CustomEntityDirtinessStrategy.AttributeInformation

Information about the attribute which is useful to help determine if it is dirty.

Returns:boolean

true indicates the attribute value has changed; false indicates it has not.

org.hibernate back to summary

public Interface CustomEntityDirtinessStrategy.AttributeInformation

Known Direct Implementers
org.hibernate.event.internal.DefaultFlushEntityEventListener.DirtyCheckAttributeInfoImpl
Annotations
@SuppressWarnings:UnusedDeclaration

Provides AttributeChecker with meta information about the attributes being checked.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

The attribute index.
getAttributeIndex
()

Many of Hibernate internals use arrays to define information about attributes.

public EntityPersister

Returns:

The entity persister.
getContainingPersister
()

Get a reference to the persister for the entity containing this attribute.

public Object

Returns:

The attributes current value
getCurrentValue
()

Get the current value of this attribute.

public Object

Returns:

The attributes loaded value
getLoadedValue
()

Get the loaded value of this attribute.

public String

Returns:

The attribute name
getName
()

Get the name of this attribute.

public Type

Returns:

The mapping type.
getType
()

Get the mapping type of this attribute.

Method Detail

getAttributeIndexback to summary
public int getAttributeIndex()

Many of Hibernate internals use arrays to define information about attributes. This value provides this index into those arrays for this particular attribute.

It can be useful if needing to leverage those Hibernate internals.

Returns:int

The attribute index.

getContainingPersisterback to summary
public EntityPersister getContainingPersister()

Get a reference to the persister for the entity containing this attribute.

Returns:EntityPersister

The entity persister.

getCurrentValueback to summary
public Object getCurrentValue()

Get the current value of this attribute.

Returns:Object

The attributes current value

getLoadedValueback to summary
public Object getLoadedValue()

Get the loaded value of this attribute.

NOTE : A call to this method may require hitting the database in cases where the loaded state is not known. In those cases the db hit is incurred only once per entity, not for each attribute.

Returns:Object

The attributes loaded value

getNameback to summary
public String getName()

Get the name of this attribute.

Returns:String

The attribute name

getTypeback to summary
public Type getType()

Get the mapping type of this attribute.

Returns:Type

The mapping type.

org.hibernate back to summary

public Interface CustomEntityDirtinessStrategy.DirtyCheckContext


A callback to drive dirty checking. Handed to the CustomEntityDirtinessStrategy#findDirty method so that it can callback on to it if it wants to handle dirty checking rather than using Hibernate's default checking
See Also
CustomEntityDirtinessStrategy#findDirty

Method Summary

Modifier and TypeMethod and Description
public void
doDirtyChecking(CustomEntityDirtinessStrategy.AttributeChecker
The delegate usable by the context for determining which attributes are dirty.
attributeChecker
)

The callback to indicate that dirty checking (the dirty attribute determination phase) should be handled by the calling CustomEntityDirtinessStrategy using the given AttributeChecker.

Method Detail

doDirtyCheckingback to summary
public void doDirtyChecking(CustomEntityDirtinessStrategy.AttributeChecker attributeChecker)

The callback to indicate that dirty checking (the dirty attribute determination phase) should be handled by the calling CustomEntityDirtinessStrategy using the given AttributeChecker.

Parameters
attributeChecker:CustomEntityDirtinessStrategy.AttributeChecker

The delegate usable by the context for determining which attributes are dirty.