Package io.jmix.core
Class SaveContext
java.lang.Object
io.jmix.core.SaveContext
- All Implemented Interfaces:
- Serializable
- Direct Known Subclasses:
- JpaSaveContext
Defines collections of entities to be saved or removed, as well as parameters of saving.
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected List<AccessConstraint<?>>protected booleanprotected Map<String,Serializable> protected boolean
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionList<AccessConstraint<?>>Returns the list of access constraints.Enables defining a fetchPlan for each committed entity.getHints()booleanbooleanAdds an entity to be removed from the database.Adds an entity to be committed to the database.Adds an entity to be committed to the database.setAccessConstraints(List<AccessConstraint<?>> accessConstraints) Sets the list of access constraints.setDiscardSaved(boolean discardSaved) Set to true if calling code does not need saved instances, which allows for performance optimization.setHint(String hintName, Serializable value) Sets custom hint that should be used by the query.setHints(Map<String, Serializable> hints) Sets custom hints that should be used by the query.setJoinTransaction(boolean joinTransaction) Sets whether to join existing transaction or always start a new one.
- 
Field Details- 
entitiesToSave
- 
entitiesToRemove
- 
fetchPlans
- 
discardSavedprotected boolean discardSaved
- 
joinTransactionprotected boolean joinTransaction
- 
accessConstraints
- 
hints
 
- 
- 
Constructor Details- 
SaveContextpublic SaveContext()
 
- 
- 
Method Details- 
savingAdds an entity to be committed to the database.This method accepts entity instances and collections. - Parameters:
- entities- entity instances
- Returns:
- this instance for chaining
 
- 
savingAdds an entity to be committed to the database.- Parameters:
- entity- entity instance
- fetchPlan- fetch plan which is used in merge operation to ensure all required attributes are loaded in the returned instance
- Returns:
- this instance for chaining
 
- 
removingAdds an entity to be removed from the database.This method accepts entity instances and collections. - Parameters:
- entities- entity instances
- Returns:
- this instance for chaining
 
- 
getEntitiesToSave- Returns:
- collection of changed entities that will be saved to the database. The collection is modifiable.
 
- 
getEntitiesToRemove- Returns:
- collection of entities that will be removed from the database. The collection is modifiable.
 
- 
getFetchPlansEnables defining a fetchPlan for each committed entity. These fetchPlans are used in merge operation to ensure all required attributes are loaded in returned instances.- Returns:
- mutable map of entities to their fetchPlans
 
- 
getHints- Returns:
- custom hints which are used by the query
 
- 
setHintSets custom hint that should be used by the query.
- 
setHintsSets custom hints that should be used by the query.
- 
isDiscardSavedpublic boolean isDiscardSaved()- Returns:
- true if calling code does not need committed instances, which allows for performance optimization
 
- 
setDiscardSavedSet to true if calling code does not need saved instances, which allows for performance optimization.
- 
getAccessConstraintsReturns the list of access constraints.
- 
setAccessConstraintsSets the list of access constraints.
- 
isJoinTransactionpublic boolean isJoinTransaction()- Returns:
- whether to join existing transaction or always start a new one
 
- 
setJoinTransactionSets whether to join existing transaction or always start a new one.
 
-