O'Reilly logo

Enterprise JavaBeans™ Component Architecture: Designing and Coding Enterprise Applications by Paul Anderson, Gail Anderson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4.2. Music Stateless Session Bean

Because read-only access is all we need with the Music Collection database, it makes sense to perform this task with a session bean. And because we do not need to keep track of client-specific data, a stateless session bean will suffice. Let's examine the code for the Music EJB now.

Home Interface

Listing 4.1 is the home interface (MusicHome) for the Music EJB. Since this is a stateless session bean, we need only a single create() method with no arguments. Note that this method returns the remote interface object, Music.

Listing 4.1. MusicHome.java
 // MusicHome.java import java.io.Serializable; import java.rmi.RemoteException; import javax.ejb.CreateException; import javax.ejb.EJBHome; public interface MusicHome ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required