This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Mastering Corda: Blockchain for Java Developers and have Jamiel Sheikh on-line!
See this thread for details.
Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

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

 
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 418
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it is till not clear !
am i too dumb ???
 
Janne Karhu
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 418
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Janne...now i understood it! :-)
 
You've gotta fight it! Don't give in! Read this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic