aspose file tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes HFE: page 291 Q.3 - Local component interface of an entity bean Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Reply Bookmark "HFE: page 291 Q.3 - Local component interface of an entity bean" Watch "HFE: page 291 Q.3 - Local component interface of an entity bean" New topic
Author

HFE: page 291 Q.3 - Local component interface of an entity bean

Rashmi Tambe
Ranch Hand

Joined: Aug 07, 2001
Posts: 418
Hi all,
Page 291, has a question (#3):
which are ways in which a client can get a reference to an existsing entity object's local component interface?
One of the correct options is -
Receive the reference as a parameter in a method call.
I have not understood this option. Can somebody explain this?
[ February 26, 2004: Message edited by: Rashmi Tambe ]
Janne Karhu
Ranch Hand

Joined: Oct 29, 2003
Posts: 33
When the client component (class) is in the same JVM as the local EJB whose local component interface it gets as a parameter, the option b works ok. For example:
Client.java:
public void myMethod(MyEJBLocalObject o)
{
o.myBusinessMethod(); //this works if the client is in the same JVM
}
Correct me if I am wrong!

Originally posted by Rashmi Tambe:
Hi all,
Page 291, has a question (#3):
which are ways in which a client can get a reference to an existsing entity object's local component interface?
One of the correct options is -
Receive the reference as a parameter in a method call.
I have not understood this option. Can somebody explain this?
[ February 26, 2004: Message edited by: Rashmi Tambe ]
Rashmi Tambe
Ranch Hand

Joined: Aug 07, 2001
Posts: 418
it is till not clear !
am i too dumb ???
Janne Karhu
Ranch Hand

Joined: Oct 29, 2003
Posts: 33
Ok, how about this:
TestBean.java:
...
private SessionContext ctx;
...
public void myBusinessMethod(...)
{
Client client = new Client();
client.doStuff((TestLocal)ctx.getEJBLocalObject());
}
public void anotherBusinessMethod()
{
//do anything
}
...
Client.java: (acts as a client for TestBean)
...
public void doStuff(TestLocal tl)
{
//see? This method gets a local component interface as a parameter!
tl.anotherBusinessMethod();
}
...
[ February 27, 2004: Message edited by: Janne Karhu ]
Rashmi Tambe
Ranch Hand

Joined: Aug 07, 2001
Posts: 418
Thanks Janne...now i understood it! :-)
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: HFE: page 291 Q.3 - Local component interface of an entity bean
 
Similar Threads
HF: Page291 Q.3
help
Working example of persistent relationships in Remote-Local entity
Which are the ways in which a client can get a reference to an existing entity object
Page 291 - ejbRemove method question