|
From: Thomas R. <tho...@tr...> - 2004-07-29 05:06:41
|
Ollie, I'll take a shot at answering your questions. 1. I have not seen the behavior for this scenarion explicitly specified in any spec - JTS/JTA/EJB/JDBC. My take is that it is implementation specific and it could depend on whether you used an XA enable driver or not. If the driver is not XA enabled, then option _a_ would be the only possible one. This is how I understand WebLogic to work in this case. Don't know about JOTM. 2. It depends on your configuration: 2.1 Spring's transaction management uses option _a_ for a "single resource" transaction definition using DataSourceTransactionManager or HibernateTransactionManager. For this to work, you don't need a JTA implementation or an XA datasource - a Commons DBCP connection pool will work fine. The "single datasource" transaction managers are of course only an option if your data access is limited to a single database. 2.2 In the case of a JTA configuration, Spring would delegate the transaction management to the JTA implementation. Now, you are again dependent on the JTA implementation and how it would handle XA vs non-XA drivers. For this you type of configuration you would use Spring's JTATransactionManager. I've never used Hibernate in an XA environment, but I'm pretty sure you have to configure it to work with your JTA implementation. Bottom line is that you should not code this logic into your application - you should rely on the transaction management implementation to manage the connenction(s) and the transaction context for you. The trick is to pick a configuration that will work for your requirements as well as with your JDBC driver/database. Hope this helps. Thomas Oliver Geisser wrote: > Hi, > > we are currently evaluating an architecture for our application which > will use the follwing frameworks: > > Tomcat + Servlet + Spring + Hibernate + JOTM + XAPool + Quartz > No EJB container! > > We are making fast progress (thanks for the very good docmentation of > Spring) but we want to understand all the details. > > We believe that we understand most of the details regarding Spring, > Hibernate sessions, Spring managing transaction, etc, but there are > still areas we have questions. > > To explain my question I will ask a EJB related question first to make > my Spring question more clear. > > Let's say I have an EJB SessionBean with declarative transaction > demarcation which will do JDBC calls like the following: > > ------------- > // some SessionBean > ... > Datasource ds = context.lookup(DATASOURCE_1_NAME); > Connection con1 = ds.getConnection(); > Connection con2 = ds.getConnection(); > > ... // execute some SQL on con1 > ... // execute some SQL on con2 > > con1.close(); > con2.close(); > > Connection con3 = ds.getConnection(); > ... // execute some SQL on con3 > con3.close(); > ---------------- > > It is clear that it is the job of the EJB container to execute all SQL > in the same transaction. This can be achieved by: > > a) Connection con1, con2 and con3 all wrap the same physical connection > to the DB and this connection is commited at the end of the > transaction. > > b) Connection con1, con2 and con3 are three different physical > connections and the container will use a JTA Transaction Manager with > 2PC to commit all connections at the end of the transaction. > > Our questions: > > 1) What is the specified behaviour for an EJB Container: a or b? > > Where is this specified: EJB Spec?, JDBC Spec?, which chapter? > If this is implementation dependent, how does JBoss, WebSphere, BEA, > etc. solve it? > > 2) What is the corresponding Spring mechanism? > We are not sure who is responsible for such a behaviour in our > architecture (see above) Is it Spring, Hibernate, XAPool, JOTM or do > we need to write our own infrastructure? > > > Thanks, Olli > > --og > > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > > > |