Professional Documents
Culture Documents
You
should only mark
@Service
@Autowired
@Override
@Transactional(readOnly=true)
//...
@Override
@Transactional
//...
@Override
@Transactional
//...
@Override
@Transactional
//...
You can still place @Transactional with propagation=Propagation.MANDATORY over DAO classes so that
they wouldn’t be
In order to be able to use Hibernate contextual session capability, you need to start a transaction even for
select operations.
Therefore, you even mark your finder methods with @Transactional annotation in service beans. However,
at the end of the
finder method, transaction is committed, and Hibernate session flush will be triggered via that commit.
Hibernate flush is an
expensive operation, which traverses all those entities existing in the Hibernate Session, and try to detect
dirty entities within it.