Search code examples
javaspringtransactional

Confused about setting the value of @transactional


Can anybody explain me that when I should put readOnly value as true and when I should set it as false when using it with @Transactional ?


Solution

  • When you are only reading/selecting from the database and not changing any data - by performing an update/insert/delete.

    If you can specify readOnly you should as its much less resource intensive.