Hi, I'm new to hibernate and trying to learn this technology. I'm trying to see how I can use hibernate in my domain layer with existing session beans facades in my service layer. How would transaction management work in this case. I'm currently running on websphere 5.1. I still want to use CMTs and let the container handle transactions set on my session beans instead of using explicit hibernate transactions. Is that feasible ? Is there any particular configuration setting required in hibernate to achieve that? Also, I usually hear about projects in which hibernate is used with Spring. How about the architecture where you have ejb session facades with hibernate. Is that a common approach ? Thanks for your help.
Your approach is fine. Actually when you have a Hibernate Session and call beginTransaction on your Hibernate Sesison, and you currently have a CMT Transaction from your EJB, Hibernate will use and join that Transaction, rather than it "creating" its own. So if you rollback your CMT Transaction, all the stuff you used Hibernate for with data will also be rolled back.
Thanks so much. But there is another question. Why would you even bother to use hibernate explicit transaction management if you can handle it declaratively using CMT on a session facade. Also, I found this:
This seems to suggest that if you're using Websphere (which I am), then you'll have problem looking up the Container Transaction Manager. Maybe this is old information and the problem is fixed. I'm not sure. Please let me know if I'm missing something.