Re: Transaction control

Gregg Wonderly <[email protected]> Mon, 16 Jan 2006 23:33:44 -0600
Newsgroups gmane.comp.java.sun.rmi
Message-ID <[email protected]>
Paulo Melo wrote:
> Hello guys!!
>
> How you implement's the transaction control in your Enterprise RMI aplications? My aplication have the folowing architeture:
>
> |-------Client-------|                                         |-------------------------Server------------------------|
> GUI -> Delegate --------Remote--------> Facade -> Business -> DAO -> DataBase.
>
> Well, i'm want control may transaction's in the facade's in way that my aplicattion use connection pool.

There are, of course, ways to do this, adhoc, and ways to do this with existing
APIs.  One of the things that you might want to look at is Jini, instead of
RMI's JRMP.  The Jini toolset, includes a distributed transaction manager, and a
  distributed leasing system.  The distributed transaction manager can be used
in a facade to interact with a system specific transaction mechanism that won't
work with other software.

> Here is my(second) question: how will I implement the transaction control
> in my connection's so that the connection gotten in the facade
 > can be the same connection that executes many insert's, update's
 > and delete's in my DataBase class? The Spring Framework would decide? How?

To implement a complex set of transactions to be controlled by a single outside
transactional system, you'll need to set JDBC autocommit off, and you'll need to
use a JDBC accessible database which can provide multi-operation commit and
rollback.

If you use the Jini transaction manager, you can wait for the "commit" call, and
then execute commit() on the Connection at that point.  If an abort() occurs,
you can execute rollback().

It is relatively straight forward to proxy this type of transactional progression.

The JTA mechanisms might be useful to you instead if you can't, or don't want to
use Jini.

Jini is, for all intents and purposes, the next generation of RMI.  It would be
good to take a look at it and the features it provides, no matter what you do
for this project.

Gregg Wonderly

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff RMI-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

For a list of frequently asked RMI questions please refer to:
http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html

To view past RMI-USERS postings, please see:
http://archives.java.sun.com/archives/rmi-users.html