coldbox-modules / cborm

The ColdBox ORM enhancements for ColdFusion ORM & Hibernate. Make ORM not suck!
https://coldbox-orm.ortusbooks.com/
8 stars 17 forks source link

feat: Add `isInTransaction()` util helper method #44

Closed michaelborn closed 3 years ago

michaelborn commented 3 years ago

This adds the ability to check whether the current executing code is inside a Hibernate transaction. Useful for preventing nested transactions:

myEntity.save(
  flush = true,
  transactional = !getORMUtil().isInTransaction()
);
lmajano commented 3 years ago

Ohh, can you add a test for this please.