Provides an implementation of the EntityPersister class that reads and writes against a native datastore type specified by the generic type parameter T
Modifiers | Name | Description |
---|---|---|
protected class |
NativeEntryEntityPersister.NativeEntryModifyingEntityAccess |
Modifiers | Name | Description |
---|---|---|
static java.lang.String |
EMBEDDED_PREFIX |
|
protected ClassMapping |
classMapping |
Fields inherited from class | Fields |
---|---|
class ThirdPartyCacheEntityPersister |
cacheAdapterRepository |
class LockableEntityPersister |
DEFAULT_TIMEOUT |
class EntityPersister |
proxyFactory, publisher, reflector, session |
Constructor and description |
---|
NativeEntryEntityPersister
(MappingContext mappingContext, PersistentEntity entity, Session session, org.springframework.context.ApplicationEventPublisher publisher) |
NativeEntryEntityPersister
(MappingContext mappingContext, PersistentEntity entity, Session session, org.springframework.context.ApplicationEventPublisher publisher, TPCacheAdapterRepository<T> cacheAdapterRepository) |
Type Params | Return Type | Name and description |
---|---|---|
|
protected boolean |
areCollectionsEqual(java.lang.Object oldValue, java.lang.Object currentValue) |
|
protected boolean |
areEqual(java.lang.Object oldValue, java.lang.Object currentValue, java.lang.String propName) |
|
protected void |
cacheEmbeddedEntry(PersistentEntity persistentEntity, java.io.Serializable nativeKey, T nativeEntry) |
|
protected void |
cacheNativeEntry(PersistentEntity persistentEntity, java.io.Serializable nativeKey, T nativeEntry) |
|
protected void |
cascadeAfterDelete(PersistentEntity persistentEntity, EntityAccess entityAccess, K key, java.lang.Object instance) Delete many-to-ones after owner delete. |
|
protected void |
cascadeBeforeDelete(PersistentEntity persistentEntity, EntityAccess entityAccess, K key, java.lang.Object instance) Delete collections before owner delete. |
|
protected void |
cascadeDeleteCollection(EntityAccess entityAccess, Association association) |
|
protected java.lang.Object |
convertBasicEntryValue(PersistentEntity persistentEntity, Basic prop, java.lang.Object entryValue) Convert a Basic (collection-style) property native entry value taken from an entity into the target property type. |
|
protected java.io.Serializable |
convertIdIfNecessary(PersistentEntity entity, java.io.Serializable nativeKey) |
|
protected java.io.Serializable |
convertToNativeKey(java.io.Serializable nativeKey) Subclasses should override to provide any conversion necessary to convert to a nativeKey |
|
static java.lang.String |
createEmbeddedCacheEntryKey(java.lang.Object instance) |
|
protected EntityAccess |
createEntityAccess(PersistentEntity persistentEntity, java.lang.Object obj, T nativeEntry) |
|
T |
createNativeObjectForEmbedded(Association embedded, java.lang.Object instance) |
|
protected T |
createNewEntry(java.lang.String family) Creates a new entry for the given family. |
|
protected T |
createNewEntry(java.lang.String family, java.lang.Object instance) Creates a new entry for the given family. |
|
java.lang.Object |
createObjectFromEmbeddedNativeEntry(PersistentEntity persistentEntity, T nativeEntry) |
|
java.lang.Object |
createObjectFromNativeEntry(PersistentEntity persistentEntity, java.io.Serializable nativeKey, T nativeEntry) |
|
protected void |
deleteEntities(PersistentEntity persistentEntity, java.lang.Iterable objects) |
|
protected void |
deleteEntity(PersistentEntity persistentEntity, java.lang.Object obj) |
|
protected void |
deleteEntries(java.lang.String family, java.util.List<K> keys) Deletes one or many entries for the given list of Keys |
|
protected void |
deleteEntry(java.lang.String family, K key, java.lang.Object entry) Deletes a single entry |
|
protected PersistentEntity |
discriminatePersistentEntity(PersistentEntity persistentEntity, T nativeEntry) Subclasses should override to customize how entities in hierarchies are discriminated |
|
protected boolean |
doManualDirtyCheck(java.lang.Object instance, java.lang.Object entry) |
|
protected boolean |
doesRequirePropertyIndexing() Subclasses should override to optimize away manual property indexing if it is not required |
|
protected K |
executeInsert(PersistentEntity persistentEntity, NativeEntryEntityPersister.NativeEntryModifyingEntityAccess entityAccess, K id, T e) Executes an insert for the given entity, entity access, identifier and native entry. |
|
protected java.lang.Object |
formulateDatabaseReference(PersistentEntity persistentEntity, Association association, java.io.Serializable associationId) Formulates a database reference for the given entity, association and association id |
|
protected K |
generateIdentifier(PersistentEntity persistentEntity, T entry) Subclasses should override to provide id generation. |
|
AssociationIndexer |
getAssociationIndexer(T nativeEntry, Association association) Obtains an indexer for the given association |
|
ClassMapping |
getClassMapping() |
|
protected T |
getEmbedded(T nativeEntry, java.lang.String key) Implementors should override to provide support for embedded objects. |
|
java.lang.String |
getEntityFamily() |
|
protected java.lang.Object |
getEntryValue(T nativeEntry, java.lang.String property) Reads a value for the given key from the native entry |
|
protected java.lang.String |
getIdentifierName(ClassMapping cm) Obtains the identifier name to use. |
|
protected java.util.Collection |
getManyToManyKeys(PersistentEntity persistentEntity, java.lang.Object obj, java.io.Serializable nativeKey, T nativeEntry, ManyToMany manyToMany) |
|
protected java.lang.String |
getNativePropertyKey(PersistentProperty prop) |
|
PropertyValueIndexer |
getPropertyIndexer(PersistentProperty property) Obtains an indexer for a particular property |
|
protected java.lang.String |
getPropertyKey(PersistentProperty prop) |
|
protected T |
handleEmbeddedInstance(Association association, java.lang.Object embeddedInstance) |
|
protected T |
handleEmbeddedInstance(Association association, java.lang.Object embeddedInstance, boolean includeNulls) |
|
protected void |
handleEmbeddedToMany(EntityAccess entityAccess, T e, PersistentProperty prop, java.lang.String key) |
|
protected void |
handleEmbeddedToOne(Association association, java.lang.String key, EntityAccess entityAccess, T nativeEntry) |
|
protected java.lang.Object |
inferNativeKey(java.lang.String family, java.lang.Object identifier) Used to establish the native key to use from the identifier defined by the object |
|
boolean |
isDirty(java.lang.Object instance, java.lang.Object entry) |
|
protected boolean |
isEmbeddedEntry(java.lang.Object entry) Tests whether a native entry is an embedded entry |
|
boolean |
isLocked(java.lang.Object o) Subclasses can override to provide locking semantics |
|
protected boolean |
isPropertyIndexed(Property mappedProperty) |
|
protected void |
loadEmbeddedCollection(EmbeddedCollection embeddedCollection, EntityAccess ea, java.lang.Object embeddedInstances, java.lang.String propertyKey) Implementors who want to the ability to read embedded collections should implement this method |
|
protected java.util.List |
loadEmbeddedCollectionKeys(Association association, EntityAccess ea, T nativeEntry) Implementors who want to support one-to-many associations embedded should implement this method |
|
java.lang.Object |
lock(java.io.Serializable id) |
|
java.lang.Object |
lock(java.io.Serializable id, int timeout) |
|
protected void |
lockEntry(PersistentEntity persistentEntity, java.lang.String entityFamily, java.io.Serializable id, int timeout) Subclasses can override to provide locking semantics |
|
protected java.util.List<java.io.Serializable> |
persistEntities(PersistentEntity persistentEntity, java.lang.Iterable objs) This is a rather simplistic and unoptimized implementation. |
|
protected java.io.Serializable |
persistEntity(PersistentEntity persistentEntity, java.lang.Object obj, boolean isInsert) |
|
protected java.io.Serializable |
persistEntity(PersistentEntity persistentEntity, java.lang.Object obj) |
|
protected K |
readIdentifierFromObject(java.lang.Object object) |
|
protected K |
readObjectIdentifier(EntityAccess entityAccess, ClassMapping cm) Reads an objects identifier using the entity access and ClassMapping instance |
|
java.io.Serializable |
refresh(java.lang.Object o) |
|
protected void |
refreshObjectStateFromNativeEntry(PersistentEntity persistentEntity, java.lang.Object obj, java.io.Serializable nativeKey, T nativeEntry) |
|
protected void |
refreshObjectStateFromNativeEntry(PersistentEntity persistentEntity, java.lang.Object obj, java.io.Serializable nativeKey, T nativeEntry, boolean isEmbedded) |
|
protected java.util.List<java.lang.Object> |
retrieveAllEntities(PersistentEntity persistentEntity, java.lang.Iterable<java.io.Serializable> keys) Simplistic default implementation of retrieveAllEntities that iterates over each key and retrieves the entities one-by-one. |
|
protected java.util.List<java.lang.Object> |
retrieveAllEntities(PersistentEntity persistentEntity, java.io.Serializable[] keys) Simplistic default implementation of retrieveAllEntities that iterates over each key and retrieves the entities one-by-one. |
|
protected java.lang.Object |
retrieveEntity(PersistentEntity persistentEntity, java.io.Serializable nativeKey) |
|
protected T |
retrieveEntry(PersistentEntity persistentEntity, java.lang.String family, java.io.Serializable key) Reads the native form of a Key/value datastore entry. |
|
protected void |
setEmbedded(T nativeEntry, java.lang.String key, T embeddedEntry) Implementors should override this method to provide support for embedded objects |
|
protected void |
setEmbeddedCollection(T nativeEntry, java.lang.String key, java.util.Collection<?> instances, java.util.List<T> embeddedEntries) Implementors should override this method to provide support for embedded objects |
|
protected void |
setEmbeddedCollectionKeys(Association association, EntityAccess embeddedEntityAccess, T embeddedEntry, java.util.List<java.io.Serializable> keys) |
|
protected void |
setEmbeddedMap(T nativeEntry, java.lang.String key, java.util.Map instances, java.util.Map<java.lang.Object, T> embeddedEntries) Implementors should override this method to provide support for maps of embedded objects |
|
protected void |
setEntryValue(T nativeEntry, java.lang.String key, java.lang.Object value) Sets a value on an entry |
|
protected void |
setManyToMany(PersistentEntity persistentEntity, java.lang.Object obj, T nativeEntry, ManyToMany manyToMany, java.util.Collection associatedObjects, java.util.Map<Association, java.util.List<java.io.Serializable>> toManyKeys) |
|
protected K |
storeEntry(PersistentEntity persistentEntity, EntityAccess entityAccess, K storeId, T nativeEntry) Stores the native form of a Key/value datastore to the actual data store |
|
void |
unlock(java.lang.Object o) |
|
protected void |
unlockEntry(PersistentEntity persistentEntity, java.lang.String entityFamily, java.io.Serializable id) Subclasses to override to provide locking semantics |
|
protected void |
updateEntry(PersistentEntity persistentEntity, EntityAccess entityAccess, K key, T entry) Updates an existing entry to the actual datastore |
Delete many-to-ones after owner delete.
Delete collections before owner delete.
Convert a Basic (collection-style) property native entry value taken from an entity into the target property type. This takes into account any generic parameter types specified on the property (e.g. Collection<Locale> tells us to convert elements into Locale objects). If you don't specify generic properties, collection elements are not modified. If the target type is known from the generic parameters, the conversion process is essentially identical to that used for single Simple properties.
persistentEntity
- The persistent entityprop
- The property in questionentryValue
- The value of the entrySubclasses should override to provide any conversion necessary to convert to a nativeKey
nativeKey
- The keyCreates a new entry for the given family.
family
- The familyCreates a new entry for the given family.
family
- The familyDeletes one or many entries for the given list of Keys
family
- The familykeys
- The keysDeletes a single entry
family
- The familykey
- The keyentry
- the entrySubclasses should override to customize how entities in hierarchies are discriminated
persistentEntity
- The PersistentEntitynativeEntry
- The native entrySubclasses should override to optimize away manual property indexing if it is not required
Executes an insert for the given entity, entity access, identifier and native entry. Any before interceptors will be triggered
Formulates a database reference for the given entity, association and association id
persistentEntity
- The entity being persistedassociation
- The associationassociationId
- The association idSubclasses should override to provide id generation. If an identifier is only generated via an insert operation then this method should return null
persistentEntity
- The entityentry
- The native entryObtains an indexer for the given association
nativeEntry
- The native entryassociation
- The associationImplementors should override to provide support for embedded objects.
nativeEntry
- The native entry to read the embedded instance fromkey
- The keyReads a value for the given key from the native entry
nativeEntry
- The native entry. Could be a ColumnFamily, a BigTable entity, a Map etc.property
- The property keyObtains the identifier name to use. Subclasses can override to provide their own strategy for looking up an identifier name
cm
- The ClassMapping instanceObtains an indexer for a particular property
property
- The property to indexUsed to establish the native key to use from the identifier defined by the object
family
- The familyidentifier
- The identifier specified by the objectTests whether a native entry is an embedded entry
entry
- The native entrySubclasses can override to provide locking semantics
o
- The objectImplementors who want to the ability to read embedded collections should implement this method
embeddedCollection
- The EmbeddedCollection instanceea
- The EntityAccess instanceembeddedInstances
- The embedded instancespropertyKey
- The property keyImplementors who want to support one-to-many associations embedded should implement this method
association
- The associationSubclasses can override to provide locking semantics
persistentEntity
- The PesistentEntity instnaceentityFamily
- The familyid
- The identifertimeout
- The lock timeout in secondsThis is a rather simplistic and unoptimized implementation. Subclasses can override to provide batch insert capabilities to optimize the insertion of multiple entities in one go
persistentEntity
- The persistent entityobjs
- The objext to persistReads an objects identifier using the entity access and ClassMapping instance
Simplistic default implementation of retrieveAllEntities that iterates over each key and retrieves the entities one-by-one. Data stores that support batch retrieval can optimize this to retrieve all entities in one go.
persistentEntity
- The persist entitykeys
- The keysSimplistic default implementation of retrieveAllEntities that iterates over each key and retrieves the entities one-by-one. Data stores that support batch retrieval can optimize this to retrieve all entities in one go.
persistentEntity
- The persist entitykeys
- The keysReads the native form of a Key/value datastore entry. This could be a ColumnFamily, a BigTable Entity, a Map etc.
persistentEntity
- The persistent entityfamily
- The familykey
- The keyImplementors should override this method to provide support for embedded objects
nativeEntry
- The native entrykey
- The keyembeddedEntry
- The embedded objectImplementors should override this method to provide support for embedded objects
nativeEntry
- The native entrykey
- The keyinstances
- the embedded instancesembeddedEntries
- the native entriesImplementors should override this method to provide support for maps of embedded objects
nativeEntry
- The native entrykey
- The keyinstances
- the embedded instancesembeddedEntries
- the native entriesSets a value on an entry
nativeEntry
- The native entry such as a BigTable Entity, ColumnFamily etc.key
- The keyvalue
- The valueStores the native form of a Key/value datastore to the actual data store
persistentEntity
- The persistent entityentityAccess
- The EntityAccessnativeEntry
- The native form. Could be a a ColumnFamily, BigTable Entity etc.Subclasses to override to provide locking semantics
persistentEntity
- The persistent entityentityFamily
- The entity familyid
- The identiferUpdates an existing entry to the actual datastore
persistentEntity
- The PersistentEntityentityAccess
- The EntityAccesskey
- The key of the object to updateentry
- The entry