elihusmails wrote:
I am working on creating a library that contains entities and DAO for a database. Most examples/tutorials I have seen do not have any notion of transactions in them. Is this because the calling application should wrap the DAO method calls in the beingTransaction(), commit() / rollback() code, or is there an easier way to do things?
I have looked in to using only hibernate libraries and am not looking into using Spring to help manage the database operations.
Thanks in advance,
Mark
It depends... If you DAO covers a complete business case and not only a part of it, you could do the transaction management inside. But I would recommend NOT to do so. In a few months you have to extend your use case and use a second DAO then you have to span the transaction over both DAOs.
If you use Hibernate inside a JBoss (or any other JEE-Server) you can leave transaction management to that server.