??!!!!
You CANNOT, in general, call your beans by instantiating their
implementation class instance and calling methods on it. You'd have to
provide many features of the container for the instance. E.g. if you
instantiate a CMP "bean" that way, you'd have to provide persistence and so
forth.
There are times, when you can call "beans" this way (this is a hack anyway),
but you have to analyze your code thoroughly and check, whether any
container features are required. Most probably it is possible to call some
of the methods of stateless session beans this way. But you SHOULD NOT
consider this to be "bean calls" anyway.
Alexander Klyubin
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Narinder Singh
Sent: Tuesday, February 13, 2001 08:11
To: [EMAIL PROTECTED]
Subject: [jBoss-User] Calling methods of a Bean from another Session
Bean.
Hi
I need to call methods of a Session Bean from another bean.
I was previously using the following method for this.
Context jndiContext = new InitialContext();
InterestHome interestHome = (InterestHome
)jndiContext.lookup("InterestBean");
Interest interest = ((InterestHome)interestHome).create();
interest.calculateInterest();
I have found that this can be done in another way also.
InterestBean interest = new InterestBean();
interest.calculateInterest();
I have tested both implementations on jboss.
The second method is much faster than the first one. but I doubt whether it
is ok to use the second method.
Can anyone tell me if I can use the second method without any problems (such
as transaction handling),
or what are the problems in using the second method.
Regards
Narinder.
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
List Help?: [EMAIL PROTECTED]
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
List Help?: [EMAIL PROTECTED]