# IsWithinORMTransaction()

Returns `true` if a Hibernate ORM transaction is currently active on any ORM datasource. Safe to call when ORM is not configured — returns `false`.

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

```
IsWithinORMTransaction( );
```

**Returns:** boolean

`true` if a Hibernate transaction is active, `false` otherwise.

*This function does not take any arguments.*

# Usage Notes

*New in 5.6.* Replaces the need for Java hacks like ACF's `TransactionTag.getCurrent()` reflection pattern.

Safe to call at any time — returns `false` if ORM is not enabled or no transaction is active.

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

# Examples

```cfml
// Outside any transaction
isWithinORMTransaction(); // false

transaction {
	isWithinORMTransaction(); // true
	entitySave( entityNew( "User", { name: "Susi" } ) );
}

isWithinORMTransaction(); // false
```







# Categories

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