> -----Original Message-----
> From: Kesavanarayanan, Ramesh (Cognizant)
> [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, September 08, 2002 11:22 PM
> To: [EMAIL PROTECTED]
> Subject: need help in EJBHomeFcatory
>
> Hi all,.
>
> I got a code snippet of EJBHomeFactory.
>
> One of the methods is
>
> public static EJBHome lookUpHome( String jndiName, Class
> homeClass ) throws
> NamingException
> {
> return EJBHomeFactory.getFactory().lookUp( jndiName, homeClass );
> }
>
> this places of the burden of remembering the jndiname of the
> home class we
> need to use.
>
> How will I abstract this deeper so that the client needs to
> call only the
> following method instead of the above one.
>
> public static EJBHome lookUpHome( Class homeClass ) throws
> NamingException
> {
> return EJBHomeFactory.getFactory().lookUp( homeClass );
> }
It often seems inconvenient to have to specify both. Another poster indicated you could use the class name as the JNDI name. That would work, but that means you'll have to change your ejb-jar.xml file, and make sure they are always identical.
It's also worthwhile to understand that in some systems/applications, there is not a direct one-to-one mapping between all the Home classes and a JNDI name. The mapping of an "ejb-name" to a triad of Home, Component and Impl classes is more flexible than that, and some people take advantage of that. In general, however, most systems will have that simple one-to-one mapping.
