18.04.2013 Views

B2B Integration : A Practical Guide to Collaborative E-commerce

B2B Integration : A Practical Guide to Collaborative E-commerce

B2B Integration : A Practical Guide to Collaborative E-commerce

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

248 <strong>B2B</strong> <strong>Integration</strong> — A <strong>Practical</strong> <strong>Guide</strong> <strong>to</strong> <strong>Collaborative</strong> E-<strong>commerce</strong><br />

Session beans<br />

Session beans represent behaviors associated with client sessions. A<br />

session bean instance is typically private <strong>to</strong> a particular client connection.<br />

It is usually not shared among multiple clients and therefore becomes a<br />

logical extension of the client application. Interfaces are defined <strong>to</strong><br />

support a session bean accessing and modifying data as part of a<br />

transaction.<br />

SESSION BEAN PROPERTIES<br />

• Transaction capable;<br />

• Handles one transaction at a time;<br />

• Accesses and updates database for the client;<br />

• A logical extension of the client;<br />

• Used only by client who creates it;<br />

• Short lived — lives only as long as the client;<br />

• Does not survive crash of client or server;<br />

• Hides its identity (appears anonymous);<br />

• No finder method; and<br />

• Fields represent the state of the transient conversation with the<br />

client.<br />

Stateless versus stateful session beans<br />

Session beans can be either stateful or stateless. A stateless session<br />

bean does not maintain an internal state and has no persistence. The<br />

state of the bean will always be the same both before and after any<br />

method calls or transactions have occurred. Since session beans of the<br />

same type are identical, they can be pooled <strong>to</strong> service multiple clients.<br />

They can also be created and destroyed easily by the container, since<br />

they hold no state.<br />

A stateful session bean, on the other hand, maintains an internal<br />

state that can be accessed and modified directly by the client. A stateful<br />

bean can be accessed by only one EJB client and becomes a logical

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

Saved successfully!

Ooh no, something went wrong!