# EntityDelete()

Deletes the record from the database for the specified entity.

**Requires Extension:** [Hibernate ORM Engine Extension](https://download.lucee.org/#FAD1E8CB-4F45-4184-86359145767C29DE)

```
EntityDelete( name=object );
```

**Returns:** void

# Arguments

| Argument | Type | Required | Description | Default |
|----------|------|----------|-------------|---------|
| name | object | Yes | Name of the entity being deleted. |  |

# Usage Notes

The entity must be **persistent** (loaded from the database or previously saved). Deleting a transient entity has no effect.

The actual DELETE SQL executes on session flush, not immediately. Use a `transaction` block for rollback safety.

See [ORM - Sessions and Transactions](../../recipes/orm-session-and-transactions.md) for details on flush timing.

# Examples

```cfml
// Delete by loading first
user = entityLoadByPK( "User", 42 );
if ( !isNull( user ) )
	entityDelete( user );
ormFlush();

// Delete inside a transaction (recommended)
transaction {
	product = entityLoadByPK( "Product", "abc-123" );
	if ( !isNull( product ) )
		entityDelete( product );
}
```







# Categories

[ORM](../../categories/orm.md)

# See Also

[ORM - Getting Started](../../recipes/orm-getting-started.md)