-
1. Re: Different SessionFactory for JBPM and Application - same
hoogenbj May 15, 2006 1:18 AM (in response to galbelli)Yes. I use two databases; one for jBPM and one for the domain data model. There are two different database connections, but they both are part of the same distributed transaction. My stateless session bean takes care of that.
Regards
Johan -
2. Re: Different SessionFactory for JBPM and Application - same
galbelli May 15, 2006 7:54 AM (in response to galbelli)I was hoping not to have to use distributed transactions giving the same underlying database connection is being used.
-
3. Re: Different SessionFactory for JBPM and Application - same
hoogenbj May 15, 2006 9:02 AM (in response to galbelli)Well, maybe that is true today. What if tomorrow you no longer use the same underlying database connection?
Perhaps you should make your application not care about it. In my dev environment everything is in the same database, but in my production environment I have two separate databases. My app doesn't care because I use two different datasources. -
4. Re: Different SessionFactory for JBPM and Application - same
aguizar May 15, 2006 7:39 PM (in response to galbelli)"galbelli" wrote:
I was hoping not to have to use distributed transactions giv[en] the same underlying database connection is being used.
Are you sure? The only way two different hibernate sessions use the same jdbc connection at the same time is providing the connection yourself. Otherwise each session will obtain a separate connection (even for the same database) and, in consequence, begin separate local transactions if they are not configured for global transactions. -
5. Re: Different SessionFactory for JBPM and Application - same
galbelli May 15, 2006 9:20 PM (in response to galbelli)I should have been more specific. I have implemented a ConnectionProvider that utlilizes ThreadLocal to ensure the same connection is returned.
-
6. Re: Different SessionFactory for JBPM and Application - same
aguizar May 15, 2006 9:35 PM (in response to galbelli)Nice :-)
Let us know how it goes. -
7. Re: Different SessionFactory for JBPM and Application - same
hoogenbj May 16, 2006 12:31 AM (in response to galbelli)Why go to that much trouble?
-
8. Re: Different SessionFactory for JBPM and Application - same
galbelli May 16, 2006 6:56 AM (in response to galbelli)- Our DBAs do not allow/enable distributed transactions on our databases.
- XA has it's place but recovery can be an issue at times. So, if it is not necessary why add the complexity of multiple resource managers when there is actually only one.
- App servers play the same game by returning the same connection from a "Transactional Resource" (BEA for example) while inside a transaction, so it seemed reasonable.
Aside from using XA, would you have recommended a different approach?