api-docs / org.ktorm.entity / Entity / delete
delete
abstract fun delete(): Int
(source code)Delete this entity in the database and return the affected record number.
Similar to flushChanges, we need to note that:
- The function requires a primary key specified in the table object via Table.primaryKey,
otherwise, Ktorm doesn’t know how to identify entity objects. - The entity object calling this function must be ATTACHED to the database first.
See Also