public interface Persister extends one.microstream.reference.ObjectSwizzling, PersistenceStoring
| Modifier and Type | Method and Description |
|---|---|
Storer |
createEagerStorer()
Creates a new
Storer instance with eager storing behavior. |
Storer |
createLazyStorer()
Creates a new
Storer instance with lazy storing behavior. |
Storer |
createStorer()
Creates a new
Storer instance with default storing behavior. |
Object |
getObject(long objectId) |
long |
store(Object instance)
Stores the passed instance in any case and all referenced instances of persistable references recursively,
but stores referenced instances only if they are newly encountered (e.g.
|
void |
storeAll(Iterable<?> instances)
Convenience method to
PersistenceStoring.store(Object) all instances of an Iterable type, usually a collection.The passed instance itself is NOT stored. Note that this method does not return an array of objectIds, since the amount of instances supplied by the passed Iterable cannot be known until after all instances have been stored and the memory and performance
overhead to collect them dynamically would not be worth it in most cases since the returned array is hardly ever
needed. |
long[] |
storeAll(Object... instances)
Convenience method to
PersistenceStoring.store(Object) multiple instances. |
Object getObject(long objectId)
getObject in interface one.microstream.reference.ObjectSwizzlinglong store(Object instance)
store in interface PersistenceStoringinstance - the root instance of the subgraph of required instances to be stored.long[] storeAll(Object... instances)
PersistenceStoring.store(Object) multiple instances.
The passed array (maybe implicitely created by the compiler) itself is NOT stored.storeAll in interface PersistenceStoringinstances - multiple root instances of the subgraphs of required instances to be stored.void storeAll(Iterable<?> instances)
PersistenceStoring.store(Object) all instances of an Iterable type, usually a collection.Iterable cannot be known until after all instances have been stored and the memory and performance
overhead to collect them dynamically would not be worth it in most cases since the returned array is hardly ever
needed.
If it should be needed, the desired behavior can be easily achieved with a tiny custom-made utility method.storeAll in interface PersistenceStoringinstances - multiple root instances of the subgraphs of required instances to be stored.Storer createLazyStorer()
Storer instance with lazy storing behavior. This means an entity instance encountered
while traversing the entity graph is only stored if it is not yet known to the persistence context, i.e.
does not have an objectId associated with it in the persistence context's PersistenceObjectRegistry.Storer instance.Storer createStorer()
Storer instance with default storing behavior. The default is lazy storing.
See createLazyStorer().Storer instance.Storer createEagerStorer()
Storer instance with eager storing behavior. This means an entity instance encountered
while traversing the entity graph is always stored, regardless of if it is already known to the persistence
context or not, i.e. does have an objectId associated with it in the persistence context's
PersistenceObjectRegistry.
Note: Eager storing is a dangerous behavior since - depending on the entity graph's referential layout -
it can cause the whole entity graph present in the heap to be stored. Therefore, it is stronly advised to
instead use lazy storing logic (see createLazyStorer()) or some other kind of limiting storing logic.
Storer instance.Copyright © 2022 MicroStream Software. All rights reserved.