Why do we use Type narrwoing while obtaining Home Interface
1 posts in topic
Flat View  Flat View

Posted By:   Deepak_Kalra
Posted On:   Monday, March 8, 2004 02:49 AM

Hi, We normally use narrow method for casting of home interface as

Object ref = ctx.lookup("ejb20-statelessSession-TraderHomeExam");


Can't we use direct cast operator as

TraderHome home = (TraderHome) ctx.lookup("ejb20-statelessSession-TraderHomeExam");


It is because of IIOP compatibility. Just remember it.

Posted By:   Rui_Hu  
Posted On:   Monday, March 8, 2004 07:28 AM

Home reference from JNDI is the only place you will ever need narrowing, just remember it.

narrowing is more advanced casting.

It give you different object, while casting give you same object, but different type.

Narrowing, you can think it as, create a new object based on the information you have.
About | Sitemap | Contact