|
From: Oliver G. <oli...@gm...> - 2004-07-28 21:38:33
|
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
|