Package com.sap.cds.ql
Interface Upsert
- All Superinterfaces:
CqnStatement
,CqnUpsert
,CqnXsert
,JSONizable
,Statement<Upsert>
The Upsert builder allows to construct a CDS QL Upsert statements, which can
be executed via the
CdsDataStore
.
An Upsert statement updates an entity from the given data. The key of the entity
that is upserted is expected to be in the data. If the entity doesn't exist and the key
is given in the data, it inserts a new entry.-
Method Summary
Modifier and TypeMethodDescriptionstatic Upsert
static Upsert
Creates an upsert statement to upsert data for a specified entity set.static Upsert
Deprecated, for removal: This API element is subject to removal in a future version.Sets the batch data to be inserted or updated by the upsert statement.Adds a single entry to be upserted into the entity set.Adds a single entry to be upserted into the entity set.static Upsert
into
(CqnStructuredTypeRef ref) Creates an upsert statement to upsert entries into a specified entity set.static Upsert
Creates an upsert statement to upsert entries into a specified entity set.static Upsert
into
(CdsEntity entity, UnaryOperator<StructuredType<?>> path) Creates an upsert statement to upsert entries into a specified entity set.static <R extends StructuredType<R>,
T extends StructuredType<T>>
UpsertCreates an upsert statement to upsert entries into a specified entity set.static <T extends StructuredType<T>>
UpsertCreates an upsert statement to upsert entries into a specified entity set.static Upsert
Creates an upsert statement to upsert entries into a specified entity set.static Upsert
into
(String qualifiedName, UnaryOperator<StructuredType<?>> path) Creates an upsert statement to upsert entries into a specified entity set.static <T extends StructuredType<?>>
Upsertinto
(T entity) Creates an upsert statement to upsert entries into a specified entity set.Methods inherited from interface com.sap.cds.ql.cqn.CqnStatement
asDelete, asInsert, asSelect, asUpdate, hints, isDelete, isInsert, isSelect, isUpdate, ref
Methods inherited from interface com.sap.cds.JSONizable
toJson
-
Method Details
-
into
Creates an upsert statement to upsert entries into a specified entity set.- Parameters:
qualifiedName
- the fully qualified name of the CDS entity set- Returns:
- the upsert statement
-
into
Creates an upsert statement to upsert entries into a specified entity set.- Parameters:
ref
- the ref to the entity- Returns:
- the upsert statement
-
into
Creates an upsert statement to upsert entries into a specified entity set.- Type Parameters:
T
- the type of the entity set- Parameters:
entity
- the structured type representing the entity set- Returns:
- the upsert statement
-
into
Creates an upsert statement to upsert entries into a specified entity set.- Parameters:
qualifiedName
- the fully qualified name of the CDS entity setpath
- a path expression navigating from the root entity to the target entity of the upsert statement- Returns:
- the upsert statement
-
into
Creates an upsert statement to upsert entries into a specified entity set.- Type Parameters:
T
- the type of the entity set- Parameters:
entity
- the static model representation of the entity set- Returns:
- the upsert statement
-
into
static <R extends StructuredType<R>,T extends StructuredType<T>> Upsert into(Class<R> entity, Function<R, T> path) Creates an upsert statement to upsert entries into a specified entity set.- Type Parameters:
R
- the type of the root entityT
- the type of the target entity- Parameters:
entity
- the static model representation of the entity setpath
- a path expression navigating from the root entity to the target entity of the upsert statement- Returns:
- the upsert statement
-
into
Creates an upsert statement to upsert entries into a specified entity set.- Parameters:
entity
- the model representation of the entity set obtained by reflection- Returns:
- the upsert statement
- See Also:
-
into
Creates an upsert statement to upsert entries into a specified entity set.- Parameters:
entity
- the model representation of the entity set obtained by reflectionpath
- a path expression navigating from the root entity to the target entity of the upsert statement- Returns:
- the upsert statement
- See Also:
-
copy
- Parameters:
upsert
- theCqnUpsert
to be copied- Returns:
- the modifiable upsert statement copy
-
cqn
Deprecated, for removal: This API element is subject to removal in a future version.Usecqn(CdsModel, String)
instead.Creates an upsert statement to upsert data for a specified entity set.- Parameters:
cqnUpsert
- the CQN representation of the upsert statement- Returns:
- the upsert statement
-
cqn
Creates an upsert statement to upsert data for a specified entity set.- Parameters:
model
- the CDS modelcqnUpsert
- the CQN representation of the upsert statement- Returns:
- the upsert statement
-
entries
Sets the batch data to be inserted or updated by the upsert statement. The data is given as a collection of maps from element names of the target entity set to their new values. The data must contain the entities' keys.- Parameters:
entries
- a collection of data where every element is the canonical representation- Returns:
- the upsert statement
-
entry
Adds a single entry to be upserted into the entity set. The data is given as a Map<String, Object> that maps element names of the target entity set to the values to be upserted.The value can be deeply structured to represent a structured document:
- for single-valued relationships the value of the element is of type Map<String, Object>
- for collection-valued relationships the value of the element is of type List<Map<String, Object>>
- Parameters:
entry
- the data to be upserted as a map- Returns:
- the upsert statement
-
entry
Adds a single entry to be upserted into the entity set.The value can be deeply structured to represent a structured document:
- for single-valued relationships the value of the element is of type Map<String, Object>
- for collection-valued relationships the value of the element is of type List<Map<String, Object>>
- Parameters:
elementName
- the element name of the target entity for the value to be upsertedvalue
- the data to be upserted for the element- Returns:
- the upsert statement
-
cqn(CdsModel, String)
instead.