my dog learned polymorphism
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Right Stereotype for EJB3 and annotations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Right Stereotype for EJB3 and annotations" Watch "Right Stereotype for EJB3 and annotations" New topic

Right Stereotype for EJB3 and annotations

Neetu mukur

Joined: Jan 29, 2010
Posts: 6
Hello Ranches,

I am working hard to finish my assignment SCEA-2 this week , just want to clear some point , please help!!

1) In UML how can I show the dependency Injection (I am using @annotations )of a Class/Resource objcet or just has a dependecy with a split line/arrow ??
2) In UML what are right Stereotype for EJB3 ie is it
EJB3 Entity bean /POJO : <<entity>> or <<Entity Bean>>
EJB3 Session Bean <<Session Bean>> or <<StatefulSessionBean>> I mean which is better ?

3) What if my SessionBean also has a @webService annotation, Can we specify two sterotypes ??

4) In starUML how can I get the "tree configuration" I mean if three class has the same parent how can i make it one arrow connecting all the child classes
I could not find the function in the StarUML, I really need this one!

5 )In my CLass diagram i ma showing only my Business Classes, you think I will be OK or should I include some Controller/Boundry Classes ??
if i do use a controller then it will connect(dependency arrow) to most of my POJOs/entities, is it right ??

Thanks a lot!!
Suresh Gopalakrishnan

Joined: Aug 08, 2006
Posts: 25
Hi Neetu,

1. As per the Mark Glade Book's Chapter 9, (2nd Edition) using @annotations is fine.

2. In EJB3.0 there is no "Entity Bean". So I used <<entity>> stereo type in my assignment.
In addition to that <<stateless-session-bean>> & <<stateful-session-bean>> & <<message-driven-bean>> can
be used respectively.

3. I think you can specify two stereo types, otherwise try using notes..

4. I have drawn the tree configuration in ArgoUML, but there is no direct structure. You have to break/drag the link,
manually for tree configuration.

5. Yes. If you include Controller, you better have the dependency arrow instead of Association arrow.
Association arrow needs to be used between the Business Domain Modal classes.


Neetu mukur

Joined: Jan 29, 2010
Posts: 6
Thanks Suresh, thank you so much! This information is very useful!
Just one (I guess 2 ) more silly question
1 ) In my Class diagram I have only 16 classes for business entities, you think is it really small Class Diagram ??
2) I am planing not to use DAOs also, so in my design I have

JSF>>Managed Bean>>SessionBean>> Entities

so not really any explicy pattrens, you think this desing is too simple ??
(In point of view with JSF/EJB3 you do not need lot of pattrens as with PersistanceContext/Unit, you can switch to a different Database whenever you wanted)
and all the calls are from inside the appplication so also no need for a SessionFacade, what are you views on this ??
Please advice!
Thanks again!
Suresh Gopalakrishnan

Joined: Aug 08, 2006
Posts: 25
Don't worry about just having 16 classes.
You are right.. with JEE and EJB3, there a less patterns since Patterns like ServiceLocator are not needed.

But I strongly suggest you to introduce the DAO classes.
If you introduce DAO classes, then there will be clear separation between the business logic (session bean) and persistence logic (DAO + JPA)
more over introducing DAO pattern improves the maintainability & easy portability etc..

harinder singh

Joined: Jan 14, 2010
Posts: 10
Very helpul information!! Thanks you Suresh!
Suresh Gopalakrishnan

Joined: Aug 08, 2006
Posts: 25
You Always Welcome!
Neetu mukur

Joined: Jan 29, 2010
Posts: 6
Thanks Suresh!
About Stereo Types so if I have entity that has two @annotations like

so it should be like this <<@Entity,@NamedQueries>> in my User class as stereo type, is it right ??
or if i use Notes how should it be used ?? may be like write
@annotation Entity,NamedQueries
in the Notes rectangle. please advice

I am very surprised that there is not too much information on EJB3 annotations with UML

Still Little confused to use the DAOs as I will be writing all my @NamedQueries directly in POJO/Entity and injecting the PersistanceContext in Business SessionBeans so need to write that much java code.
As the following links suggested:
[/]DAOs and JPA

Please send me the Links for implementing the DAOs with JPA, because the above links looks like lot of classes (Class per Entity)!!
that will be really helpful!!
one more thing if I implement my SessionFacade, Should it be better to have both @Remote and @Local Interfaces for this class, there is nothing mentioned in my
assignment that it will be accessed remotly but then what is the point of having SessionFacade if everything is local (My understanding is : mostly use it to avoid remote calls) what you think ??

Thanks lot !

I agree. Here's the link:
subject: Right Stereotype for EJB3 and annotations
It's not a secret anymore!