Senior |
|
Joined: Wed Aug 27, 2003 6:04 am Posts: 161 Location: Linz, Austria
|
What you'll usually do in Spring is demarcate high-level declarative transactions via transactional proxies (defining a Spring TransactionProxyFactoryBean for each of your facades). In the case of Hibernate, you'll use Spring's HibernateTransactionManager as backend transaction strategy. This is similar to EJB CMT, just on plain POJOs.
Your DAOs will then automatically participate in those transactions, as long as you use Spring's HibernateTemplate (or SessionFactoryUtils) to perform your operations. DAOs will just contain the actual operation code; there won't be any transaction checks or the like in there. Such DAO method implementations are often one-liners!
Have a look at the Petclinic sample application that comes with the Spring distribution. It comes with a Hibernate-based data access layer by default, showing all of the above in action in an end-to-end application.
Juergen
|
|