I've been reading up a little on the DAO pattern, and i believe i have a fair grasp of what is being written about this pattern on the Hibernate site (
https://www.hibernate.org/328.html). However, one of the things that is being written is that DAO's should never deal with transactions and sessions. How do i then handle transactions?
Say that i obtain a UserDAO from a DAOFactory, which sets the currentSession() through a setSession() method on the UserDAO. Now, i would like to delete a user. This means that i need to start a transaction, and then finally commit. However, as far as i can see - i'm need to control the transaction outside the DAO - in my Business Logic. This is because the DAO should not have anything to do with the transaction, and then i guess the Business Logic Layer is the only option left as to where i can control it from? So, then i've suddenly put Hibernate specific code, which i though should be in the Data Access Layer, into the Business Logic Layer.
I couldn't really find much anywhere else on this, so i really hope someone out there have the chance to enlighten me and give a bried description of how transactions should be dealt with - in a way which really separates Data Access from Business Logic.
Please note that this is not a question about how to use transactions and sessions in general (that i know quite well), but a question about how transactions should be used when i try to adhere to the DAO pattern.