Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cade component diagram and DAO

 
John Lincoln
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I amusing EJB3 /JPA for the solution. I have stateless session beans as part of the solution which has Entity manager (used for all CRUD operations of database)

The business methods are within the stateless session bean, in short i don't have any separate DAO class. The entity manager is doing the abstraction.

How do i represent this in my Component diagram since entity manager is a EJB3 frame work class.

In the case example there are Inventory DAO, Pricing DAO and the sequence diagrams do show Entity Manager.

Should i give the DAO name and specify these are entity managers in brackets

Please advise


thanks








 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the sequence diagrams, I showed the session bean calling the entity manager. I named that class entity manager since it is a built in class.
 
John Lincoln
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jeanne.

In the component diagram, how should i represent them

I mean in the integration layer, just specify an instance of entity manager ( that is part of stateless session bean).

Or

There is no need to specify this at all.

Please advise
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They don't need to be in the component diagram because they aren't your components. They are part of JEE.
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I included 'EntityManager' in the class diagram with a stereotype '<< JPA >>'.
 
Luay Abdulraheem
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question1 : Including Entity Manager in Sequence diagram means that we need to include in Class diagram ?

Question2 : In general, if Entity Manager is included in Sequence diagram,is this sequence right or wrong :
...... stateless --> DAO --> Entity Manager --> Entity
OR
...... stateless --> DAO --> Entity --> Entity Manager

Question3 : Do we also need to show in our Sequence diagram, the Entity that is used as well ?

Thanks
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Some people have, some people haven't as they feel its part of API and no need to include - so, its upto you.

2) From the DAO, you would be calling the EntityManager only - why would the sequence goto Entity?

3) This is a tricky one. If the Entity is being created, its easy to show. In other cases, not so easy.
 
Luay Abdulraheem
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Can I show the Entity Manager in Sequence diagram, and not show in Class diagram ?
2 & 3) So what you are saying is that in Search operation we don't need to add the Entity in our Sequence diagram, but in Add operation we do ? or never show the Entity at all ?

Thanks,
 
Krzysztof Koziol
Ranch Hand
Posts: 133
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John Lincoln wrote:Hi,

In the case example there are Inventory DAO, Pricing DAO and the sequence diagrams do show Entity Manager.



Those are DAOs to external systems and have nothing to do with EM. In which diagram InventoryDAO or PricingDAO are used?

The question is why EmailDAO (external system as well) is not show in the 3rd diagram nevertheless that there is a call "sendEmail()".

Share your opinion, please.
 
Dumitru Postoronca
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:In the sequence diagrams, I showed the session bean calling the entity manager. I named that class entity manager since it is a built in class.

Jeanne, are you saying that you didn't use the DAO pattern for DB access in your application?
I believe the 'deprecation' of DAOs for database access has it's upsides and downsides. Is there a community consensus regarding this practice? (I was under the impression that it's still debated )
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dumitru Postoronca wrote:Jeanne, are you saying that you didn't use the DAO pattern for DB access in your application?
I believe the 'deprecation' of DAOs for database access has it's upsides and downsides. Is there a community consensus regarding this practice? (I was under the impression that it's still debated )

I didn't use the DAO in my submission because the system is so simple. In real life, I do use a DAO for JPA. As does the CodeRanch forum software.

You are correct that the topic of whether to use a DAO is not universally agreed on. I personal favor it. I do many things in real life that I didn't do in the exam submission and vice versa.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic