Basically, you have two transactional resources particpating in the same logical transaction (the database and the cache). Without the transaction manager, it is possible for these two to become out of synch if "something goes wrong".
Say for example, you ask Hibernate to flush the dirty state of an entity. So, it needs to write an entry into the cache (for the state change) and update a row into the db. So say the put into the cache works fine and then the database operation fails. Well, now the cache has consistency issues; the next time you try to read that entity, you will get back the "updated entity" even though that updated state was not successfully written to the database.
This all assumes use of the "transactional" cache strategy...
|