Which methods make sense for the local client interfaces?

You already know that the local client interfaces are missing some of the methods from their Remote counterparts. Let’s figure out which ones are missing, and why.

Do we need handles with local interfaces?

Remember why handles exist in EJB—to give you a Serializable object that you can use to re-establish a stub to the EJB object you’d been working with. The handle is just an abstraction of a remote connection. So... does this make sense on a local client?

Do we need EJBMetaData with local interfaces?

Remember what EJBMetaData is used for—to get reflection-like info about a bean. If you call getEJBMetaData() on a bean’s Remote home, you get back an object that implements EJBMetaData. That interface (EJBMetaData) has methods that let you interrogate the bean and learn more about the classes that make up the component. Would a local client ever need EJBMetaData?

Do we need isIdentical() with local interfaces?

Remember why isIdentical() exists—to let you compare two home or component interface references to see if they refer to “meaningfully equivalent” beans on the server. Would you need to use isIdentical() on a local client? (Big Hint: the server is free to implement .equals() any way it chooses...)

Do we need primary key information with local interfaces?

Remember why primary keys exist—to uniquely identify entity beans. Would you ever need to identify an entity bean on a local client?

Do we need remove methods with local interfaces? ...

Get Head First EJB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.