• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

session bean to session

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
Whena session bean uses another session benas methids to carry out some business logic,which relation ship we should use dependency arrow or assoiciation arrow..
Thanks,
 
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by rethna pillai:
Hi All,
Whena session bean uses another session benas methids to carry out some business logic,which relation ship we should use dependency arrow or assoiciation arrow..
Thanks,


A subtle question! My suggestion...
Use an association if the caller session bean has reference to the called session bean - just like any ordinary association except that
the reference might actually be to the Home rather than the Component.
Simply consider the Home itself to be a "reference" and use an association
in the diagram.
Use a dependency if the only "reference" to the called session bean is in an automatic variable, or method argument. (The one remaining venue for such a reference would be a class static variable, but that is not allowed in a session bean. I can't think of an EJB analog for that construct except maybe a private variable initialized in ejbActivate).

[ October 02, 2003: Message edited by: john prieur ]
[ October 02, 2003: Message edited by: john prieur ]
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi John,
was going thru some old threads..can i add just few things here..
well i do agree with u but partly. Correct me if i m wrong
consider an example...
in SB1(session bean1) i have
get ref of SB2 and store in x ;
Collection c = x.methodOfSB2();
this will be simple unidirectional-association..1 is getting some list from 2..
but if i say
in SB1(session bean1) i have
1st case
get ref of SB2 and store in x ;
attrib of SB1 = x.doSomething();
2nd case
get ref of SB2 and store in x ;
methodOfSB1(x){
};
This is dependency.
So if SB1 just have a ref of SB2, it can imply anything..association/dependency/aggregation/composition . It doesnt necessarily means association. It depends what u do with that reference. Am i correct??
 
Juan Rolando Prieur-Reza
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Nishant Anshul:
Collection c = x.methodOfSB2();
this will be simple unidirectional-association..1


Hi Nushant,
These doubts arise often in these forums. My answer is based on a strict interpretation of the official UML rules.
To address your example, lets start with a class:
class Things {
SB2 x;
private Collection c;
// later x and c are initialized to a session bean and c a collection containing x
public getAnotherExample( SB3 y) {
SB3 this.y = y;
Collection d;
// Initialize y and d the same way as x and c
}
... // assume that getAnotherExample is called from SomeOtherClass
// and no other declarations involving SB2 and SB3 in Things.
}
If SB2 and SB3 were ordinary classes, in your diagram you can show an
association from class Things to class SB2.
And, in the same class diagram you would show a
dependency from class Things to class SB3.
However, the implementation depends of whether Thing itself is stateful, stateless, or an ordinary POJO. And it depends on whether you are initializing the instance variables in ejbActivate or somewhere else. See?
If getAnotherExample( y) is called from another method in Things that
just passes a reference to an SB3 instance variable in Things, then
you can justify calling that an association (and assuming that those values are valid - because Thing is either an SFSB, or its an SLSB with proper Activate initialization).
I haven't addressed the rest of your reply; I'll leave it unless I hear from you about this part and we can continue from that point if you wish.
 
Nishant Anshul
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yeah John ..thats interseting to find out how deep we went
Just c the initial first thread ..okay to go ahead IMO..
i ain't contradicting u. But may i ask u if the type of object (stateless, stateful or ordinary java obj) really affects the relationship.
The choice of type of object is an implementation decision and not specification issue.
So if my class diag is tech oriented then YES relationships become more complicated if one want to describe every relation CORRECTLY. And i would definitely have both associations and dependencies relationships betwn any two session classes if needed.
On the other hand, if my class diag is domain spcf and not technology, depicting relations would be easier.
i agree with u conceptually (and even codewise )i really appreciate ur earlier resoning and its nice to find out such discussion going around in the forum..u know it really arouses interest n elevates relevancy...thnx buddy
 
Juan Rolando Prieur-Reza
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're wecome. This is a great forum.
Thanks for a stimulating question.
 
reply
    Bookmark Topic Watch Topic
  • New Topic