Local Interface Lookup in Entity Bean

Can anyone tell me like how to lookup an local Interface of an entity bean in Websphere or WSAD?

Thanx
-Murali*
LVL 13
Murali MurugesanFull stack Java developerAsked:
Who is Participating?
 
DarthModConnect With a Mentor Commented:
PAQed with points (50) refunded

DarthMod
Community Support Moderator
0
 
boonlengCommented:
Try the following codes.
    InitialContext initContext = new InitialContext();
    EJBLocalHome localHome = (EJBLocalHome) initContext.lookup("java:comp/env/" + jndiHomeName);
    SomeBeanLocal entity = localHome.findByPrimaryKey("1");

The varible 'jndiHomeName' is the ejb reference name created on the session bean.
Refer to redbook http://publib-b.boulder.ibm.com/abstracts/sg246957.html (Chapter 12 Implementing the session facade) on how to create the ejb reference.

You can also refer to the J2EE design pattern http://java.sun.com/blueprints/patterns/ServiceLocator.html for the above codes.

Regards,
Boon Leng
0
 
Murali MurugesanFull stack Java developerAuthor Commented:
I have solved the problem myself.

I had already written the above code.I also created the reference for the bean as boonleng.

The mistake was i didnt create a reference in the web.xml for that local bean.Once i created that my code was working fine.

Thanx for the help.

-Murali*

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.