users@glassfish.java.net

Re: Stateful web service injection not working

From: <glassfish_at_javadesktop.org>
Date: Mon, 14 Jul 2008 09:07:25 PDT

Hi David

To change a ejb from Stateless to Stateful you have only to change the annotation just before the bean.

I thought I had already write this code in this thread, but I cannot find it now.

You need an remote interface:

@Remote
public interface IfRemoteService{
...
}

Then a session bean implementing that interface, be stateless or stateful, and the attribute mappedName for you to control the name of that EJB

@State... (mappedName="myFavouriteEJB")
class BankingMortgageBean implements IfRemoteService[
...
}

and then in your client code you only need this

IfRemoteService remoteReference = (IfRemoteService)InitialContext.doLookup("myFavouriteEJB");

The state nature of the bean has nothing to do with JNDI.

You can browse GF JNDI using the admin console: Application Server | JNDI Browsing.

Aniceto Perez
[Message sent by forum member 'aperezymadrid' (aperezymadrid)]

http://forums.java.net/jive/thread.jspa?messageID=286460