samples.j2ee.ejb.subclass.child
Class ChildBean
java.lang.Object
|
+--samples.j2ee.ejb.subclass.parent.ParentBean
|
+--samples.j2ee.ejb.subclass.child.ChildBean
- public class ChildBean
- extends ParentBean
- implements javax.ejb.SessionBean
ChildBean is a stateless SessionBean. This bean illustrates:
- Child class to the ParentBean class
- Using subclassing to simplify related bean classes
- Contains only methods that are either unique to the Child class
or overload methods in the Parent Bean
- Using JNDI to look up and call another bean from
within a bean (callParentBean)
- See Also:
- Serialized Form
|
Method Summary |
java.lang.String |
callParentBean()
Looks up a parent bean and calls its
parentMethodOnly(). |
java.lang.String |
childSaysHello()
Returns a message identifying the method. |
static javax.naming.Context |
newInitialContext()
|
java.lang.String |
parentSaysHello()
Returns a message identifying the method. |
| Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
ChildBean
public ChildBean()
childSaysHello
public java.lang.String childSaysHello()
- Returns a message identifying the method.
This method is unique to the Child bean.
- Returns:
- String Message
parentSaysHello
public java.lang.String parentSaysHello()
- Returns a message identifying the method.
This method is inherited and overloaded by the Child bean.
- Overrides:
- parentSaysHello in class ParentBean
- Returns:
- String Message
callParentBean
public java.lang.String callParentBean()
throws java.rmi.RemoteException
- Looks up a parent bean and calls its
parentMethodOnly(). Returns a message identifying the method.
- Demonstrates calling one bean from another bean
- Uses SessionContext ctx to generate a new Context
- Uses that Context to find the ParentHome
- Returns:
- String Message
- Throws:
- java.rmi.RemoteException - if there is
a communications or systems failure
newInitialContext
public static javax.naming.Context newInitialContext()
throws java.lang.Exception