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.