13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

22.2 EJBs: You D<strong>on</strong>’t Know Beans?499Example 22.3 is a listing of our home interface. It looks like an emptyshell, but it is all that we need. The rest is handled by J2EE.Example 22.3 Sample (remote) home interfacepackage com.jadol.budgetpro;import javax.ejb.*;import java.rmi.*;/*** Remote Home Interface*/public interfaceM<strong>on</strong>eyHomeextends EJBHome{public M<strong>on</strong>eycreate()throws CreateExcepti<strong>on</strong>, RemoteExcepti<strong>on</strong>;} // interface M<strong>on</strong>eyHome22.2.4 Summarizing the PiecesWith these three pieces—the sessi<strong>on</strong> bean, the remote interface, and the homeinterface—we can see the structure of the key pieces of an EJB. Let’s reviewwhat we have:<str<strong>on</strong>g>Applicati<strong>on</strong></str<strong>on</strong>g> objectM<strong>on</strong>eyM<strong>on</strong>eyHomeM<strong>on</strong>eyBeanExtends/implementsEJBObjectEJBHomeSessi<strong>on</strong>BeanTalked about asremote interfacehome interfacethe implementati<strong>on</strong>22.2.5 EJBLocalHome and EJBLocalObjectWhen the sessi<strong>on</strong> or entity bean is going to be referenced by applicati<strong>on</strong> codethat resides <strong>on</strong> the same host as the bean, there are variati<strong>on</strong>s <strong>on</strong> the home andremote interfaces that allow for more efficient executi<strong>on</strong>. When you know thatthe beans are local to this host, you should use a local interface (Example 22.4)

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

Saved successfully!

Ooh no, something went wrong!