I have situation where I would like my client to connect to bean (Connection) and call method on it and that method would return reference to other bean (LinkSet).
Was wondering what was preferred way of doing this, or if it is not good way to do things...
Handle has getEJBObject method, but what context does it use? If my client, normal java, calls Handle.getEJBObject() how does it know what server to use etc.
Our system might have connection to several EJB servers at same time and users need to login before they can do anything. These returned bean references are session beans and need only be valid as long as user is logged into server.
Anyone done something similiar, any comments, hints or warnings?
You should be OK with using EJB Handles as you describe.
I have had a situation where an instance of EJB1 performs some action and then binds itself into some sort of session object. Later, an instance of EJB2 retrieves the session, finds the reference to EJB1, and calls it back.
Worked fine :-)