Package com.sap.cds.ql
Interface Insert
-
- All Superinterfaces:
CqnInsert
,CqnStatement
,CqnXsert
,JSONizable
,Statement<Insert>
public interface Insert extends CqnInsert, Statement<Insert>
The Insert builder allows to construct CDS QL insert statements, which can be executed via theCdsDataStore
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.sap.cds.ql.cqn.CqnXsert
CqnXsert.Kind
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static Insert
copy(CqnInsert insert)
static Insert
cqn(String cqnInsert)
Creates an insert statement from a given CQN String.Insert
entries(Iterable<? extends Map<String,?>> entries)
Sets the entries to be inserted into the entity set.Insert
entry(String elementName, Object value)
Add a single entry to be inserted into the entity set.Insert
entry(Map<String,?> entry)
Add a single entry to be inserted into the entity set.static Insert
into(CqnStructuredTypeRef ref)
Creates an insert statement to insert entries into a specified entity set.static Insert
into(CdsEntity entity)
Creates an insert statement to insert entries into a specified entity set.static <E extends StructuredType<?>>
Insertinto(E entity)
Creates an insert statement to insert entries into a specified entity set.static <E extends StructuredType<E>>
Insertinto(Class<E> entity)
Creates an insert statement to insert entries into a specified entity set.static <R extends StructuredType<R>,T extends StructuredType<T>>
Insertinto(Class<R> entity, Function<R,T> path)
Creates an insert statement to insert entries into a specified entity set.static Insert
into(String qualifiedName)
Creates an insert statement to insert entries into a specified entity set.static Insert
into(String entityName, UnaryOperator<StructuredType<?>> path)
Creates an insert statement to insert entries into a specified entity set.-
Methods inherited from interface com.sap.cds.ql.cqn.CqnStatement
asDelete, asSelect, asUpdate, asUpsert, hints, isDelete, isSelect, isUpdate, isUpsert, ref
-
Methods inherited from interface com.sap.cds.JSONizable
toJson
-
-
-
-
Method Detail
-
into
static Insert into(String qualifiedName)
Creates an insert statement to insert entries into a specified entity set.- Parameters:
qualifiedName
- the fully qualified name of the CDS entity set- Returns:
- the insert statement
-
into
static Insert into(CqnStructuredTypeRef ref)
Creates an insert statement to insert entries into a specified entity set.- Parameters:
ref
- the ref to the entity- Returns:
- the insert statement
-
into
static <E extends StructuredType<?>> Insert into(E entity)
Creates an insert statement to insert entries into a specified entity set.- Type Parameters:
E
- the type of the entity set- Parameters:
entity
- the structured type representing the entity set- Returns:
- the insert statement
-
into
static Insert into(String entityName, UnaryOperator<StructuredType<?>> path)
Creates an insert statement to insert entries into a specified entity set.- Parameters:
entityName
- the root entity name of the path expressionpath
- a path expression navigating from the root entity to the target entity of the insert statement- Returns:
- the insert statement
-
into
static <E extends StructuredType<E>> Insert into(Class<E> entity)
Creates an insert statement to insert entries into a specified entity set.- Type Parameters:
E
- the type of the entity set- Parameters:
entity
- the static model representation of the entity set- Returns:
- the insert statement
-
into
static <R extends StructuredType<R>,T extends StructuredType<T>> Insert into(Class<R> entity, Function<R,T> path)
Creates an insert statement to insert 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 insert statement- Returns:
- the insert statement
-
into
static Insert into(CdsEntity entity)
Creates an insert statement to insert entries into a specified entity set.- Parameters:
entity
- the model representation of the entity set obtained by reflection- Returns:
- the insert statement
- See Also:
CdsModel.findEntity(String)
,CdsModel.entities()
-
copy
static Insert copy(CqnInsert insert)
- Parameters:
insert
- theCqnInsert
to be copied- Returns:
- the modifiable insert statement copy
-
cqn
static Insert cqn(String cqnInsert)
Creates an insert statement from a given CQN String.- Parameters:
cqnInsert
- the CQN representation of the insert statement- Returns:
- the insert statement
-
entries
Insert entries(Iterable<? extends Map<String,?>> entries)
Sets the entries to be inserted into the entity set.- Parameters:
entries
- a collection of data where every element is the canonical representation- Returns:
- the insert statement
-
entry
Insert entry(Map<String,?> entry)
Add a single entry to be inserted 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 inserted.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 inserted as a map- Returns:
- the insert statement
-
entry
Insert entry(String elementName, Object value)
Add a single entry to be inserted 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 insertedvalue
- the data to be inserted for the element- Returns:
- the insert statement
-
-