Service Studio 8.0 Help
Entity Actions
When you create an Entity in Service Studio, you're provided with a set of Entity Actions for handling your entity records. These actions are automatically created by Service Studio for each Entity and are available under it (in the Data Layer of the eSpace Tree) as the following image shows:
Each action does the following:
Create<Entity Name>: creates a new entity record in the database. See more about the Create Action.
CreateOrUpdate<Entity Name>: either creates a new entity record in the database or updates the entity record if a record with the same key already exists in the database. See more about the CreateOrUpdate Action.
Update<Entity Name>: updates an entity record in the database. See more about the Update Action.
Get<Entity Name>: gets an entity record from the database. See more about the Get Action.
There is also a Get entity function which can be used in the Expression Editor.
Get<Entity Name>ForUpdate: gets an entity record from the database and locks it for update, i.e., preventing other processes from accessing the entity record. See more about the GetForUpdate Action
Delete<Entity Name>: deletes an entity record from the database. See more about the Delete Action.
If the entity has no primary key, only the Create<Entity> entity action is available.
When there is integration with external systems, transaction handling might need some extra care. Why?
The input arguments and output arguments of Entity Actions are record or identifiers; therefore, any changes on the Entity definition, like adding or deleting attributes or changing the properties of the attributes, are transparent to all of the Entity Actions calls.
Entity actions vs SQL statements
The Entity Actions always act upon a single record of the Entity and their SQL is very simple, i.e. no where conditions, joins or order by are available. Therefore, in some situations you have to query the database directly. For example:
result set may contain more than one records;
result set is subject to conditions of its attributes;
result set contains information about more than one entity;
the identifier of the record is unknown.
Service Studio provides you with a Query Tool where you type the SQL statements.
Whenever possible, you should use Entity Actions to manage your application data, because Service Studio translates these actions into SQL and, therefore, you don't have to type SQL statements explicitly.
See Also
Execute an Entity Action | Entity Functions | Handling Transactions with External Systems