I knew ORM tools, such as Hibernate, have their own transaction management mechanism. We can also harness transaction by using JDBC directly. And DBMS has its transaction facilities either. I wonder that in which layer(s) the transaction is actually implemented in a J2EE application? I guess that the transaction in Hibernate is built upon 开发者_JS百科on JDBC, in turn the JDBC rely the underlying DBMS to realize the Transaction. is it fair?
Regards!
In the service layer, of course.
In EJB, they're on session beans.
In Spring, they're on services.
Services know about units of work. That's why they own the transaction context.
Transaction service is not implemented at any particular application layer. If you mean by where you are going to use transaction service, it depends on your requirement. Sometimes transaction demarcation can be at view layer itself, see OpenSessionInView
In Service Layer because we write our business logic in service layer only
精彩评论