08-02-2023, 10:55 AM
When I try to read data from the database, at least using
`((Session)em.getDelegate()).createCriteria()`
an exception is throws saying that a transaction is not present.
When I add the annotation:
@Transactional(
value = SomeClass.TRANSACTIONAL_MANAGER,
propagation = Propagation.SUPPORTS,
readOnly = true
)
it works fine.
However, since reading will happen million of times per second to access and read data, I want to make sure that our environment is not clogged up unnecessarily.
**If not, what is the cost of creating a read-only `Propagation.Supports` transaction?**
Can I not create a Hibernate Criteria Query without a transaction, in combination with Spring?
`((Session)em.getDelegate()).createCriteria()`
an exception is throws saying that a transaction is not present.
When I add the annotation:
@Transactional(
value = SomeClass.TRANSACTIONAL_MANAGER,
propagation = Propagation.SUPPORTS,
readOnly = true
)
it works fine.
However, since reading will happen million of times per second to access and read data, I want to make sure that our environment is not clogged up unnecessarily.
**If not, what is the cost of creating a read-only `Propagation.Supports` transaction?**
Can I not create a Hibernate Criteria Query without a transaction, in combination with Spring?