An EJB factory encapsulates the function provided by two objects: an InitialContext and an enterprise bean's home interface. It allows you to set the provider URL and other settings needed to perform the enterprise bean home lookup operation. The superclass of the EJB factory hides the implementation details of performing the lookup in the name service and the PortableRemoteObject.narrow() operation needed to acquire the EJB home implementation. (Note that EJB factories are not serializable because they are helper classes used to obtain remote EJB instances.)
EJB factories are automatically generated whenever you choose to generate one of the following access bean types using the Add an Access Bean wizard:
Home interface mapping
The purpose of an EJB factory is to provide the means for creating references to enterprise bean remote objects. The factory class does this by implementing the methods of the home interface of the enterprise bean and delegating those method calls to an instance of the home of the enterprise bean. The factory class gets a reference to an EJBHome by performing a 'lookup' in a specific name service. You can direct the lookup call to any name service or use the default settings. When the first call is made to an EJBHome method, the instance acquires the EJBHome object by performing the lookup operation.JNDI mapping
A default JNDI name is generated into each access bean class. The code generator uses the JNDI name specified in the extensions editor, which by default is the home interface name. You can change the JNDI name using setJNDIName().