Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Enterprise JavaBeans™ Specification, Version 2.0 - Sun Microsystems.pdf
Скачиваний:
14
Добавлен:
24.05.2014
Размер:
2.71 Mб
Скачать

Sun Microsystems Inc

Type narrowing

Enterprise JavaBeans 2.0, Public Draft

Client View of a Session Bean

The following example illustrates the use of the isIdentical method for a stateless session object.

FooHome fooHome = ...; // obtain home of a stateless session bean Foo foo1 = fooHome.create();

Foo foo2 = fooHome.create();

if (foo1.isIdentical(foo1)) {// this test returns true

...

}

if (foo1.isIdentical(foo2)) {// this test returns true

...

}

5.8.3 getPrimaryKey()

The object identifier of a session object is, in general, opaque to the client. The result of getPrimaryKey() on a session EJBObject reference results in java.rmi.RemoteException.

5.9 Type narrowing

A client program that is intended to be interoperable with all compliant EJB Container implementations must use the javax.rmi.PortableRemoteObject.narrow(...) method to perform type-narrowing of the client-side representations of the home and remote interface.

Note: Programs using the cast operator for narrowing the remote and home interfaces are likely to fail if the Container implementation uses RMI-IIOP as the underlying communication transport.

55

5/31/00

Sun Microsystems Inc.

Client View of a Session Bean

Enterprise JavaBeans 2.0, Public Draft

Type narrowing

5/31/00

56