10.12.2012 Views

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

The Java EE 5 Tutorial (PDF) - Oracle Software Downloads

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Updating Multiple Databases<br />

998<br />

Bean-B. <strong>The</strong> second business method updates Database Z and returns control to the business<br />

method in Bean-A, which commits the transaction. All three database updates occur in the same<br />

transaction.<br />

FIGURE 33–2 Updating Multiple Databases<br />

Client<br />

Databases<br />

Bean-A<br />

Bean-B<br />

X Y Z<br />

<strong>Java</strong> <strong>EE</strong><br />

Server<br />

In Figure 33–3, the client calls a business method in Bean-A, which begins a transaction and<br />

updates Database X. <strong>The</strong>n Bean-A invokes a method in Bean-B, which resides in a remote <strong>Java</strong><br />

<strong>EE</strong> server. <strong>The</strong> method in Bean-B updates Database Y. <strong>The</strong> transaction managers of the <strong>Java</strong> <strong>EE</strong><br />

servers ensure that both databases are updated in the same transaction.<br />

<strong>The</strong> <strong>Java</strong> <strong>EE</strong> 5<strong>Tutorial</strong> • June 2010

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!