I am trying to find out tiny differences in Hibernate update queries and I have come to two interesting possibilities:
- Executing updates in transaction (for instance in methods annotated with
@Transactional
. - Executing updates without transaction as follows:
`
Connection connection = entityManager.getDataSource().getConnection();
connection.prepareStatement(...);
affectedRows = ps.executeUpdate();
The second doesn't create transactions, so I guess it could be faster? Consider very simple update queries, for which I don't really need transaction. What is the real difference?