• 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
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Should I have Entity Manager in the Sequence diagram

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In most of my Sequence diagrams, the last object is the DAO. In some posts on the forum some people are saying that they have included the Entity Manager in their Sequence diagrams.

Question: 1) Adding the Entity Manager in Sequence diagrams means adding it in the Class diagram as well ?
2) Adding the Entity Manager in Sequence diagrams means adding the Entities in Sequence diagrams as well ?
 
author & internet detective
Posts: 40533
825
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) No. It is fine to keep the class diagrams to classes owned by your system.
2) It's up to you. I didn't because it was confusing. I ended with the entity manager.
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On the same lines, if I have a find operation, do I have to show the Query object on the sequence diagrams?

Please help.

Thank you.
 
Luay Abdulraheem
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Suppose I end with an Entity Manager, the DAO will send a message to Entity Manager, but will the Entity Manager send a reply message to DAO ? Because in Cade's example there is only a message but with no reply message from Entity Manager.
 
Jeanne Boyarsky
author & internet detective
Posts: 40533
825
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Pratik: I wouldn't. We don't show Strings and ArrayLists and other built in objects in the sequence diagram.

Luay: He calls persist() which returns void. Most people use the return arrow anyway to show the method has completed, but this might be why. I've added it to the list of non-standard things in the Cade/Sheil solution.
 
Ranch Hand
Posts: 133
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Luay Abdulraheem wrote:Suppose I end with an Entity Manager, the DAO will send a message to Entity Manager, but will the Entity Manager send a reply message to DAO ? Because in Cade's example there is only a message but with no reply message from Entity Manager.



I think it makes sense only when EM perform search and will return some object or collection of objects. BTW, how to show when EM will call named query, should we put all calls in sequence diagram: EM.createNamedQuery().getResultList() ?

Is it really important to show EM on sequence diagram even when we have self-descriptive method in our DAO, let's say userDao.findUserByName(). Everybody knows that under the hood we need to call one of create*Query() on EM and then getSingleResult() or getResultList() on Query object.
 
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think you need to show to the detail of the 'named query'. I have a similar 'findBy' method and I just showed it going to EntityManager with a 'query' action name - to just indicate that entitymanager is used to query the database.
 
Krzysztof Koziol
Ranch Hand
Posts: 133
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ranganathan Kaliyur Mannar wrote:I don't think you need to show to the detail of the 'named query'. I have a similar 'findBy' method and I just showed it going to EntityManager with a 'query' action name - to just indicate that entitymanager is used to query the database.



Have you got DAO before EM call?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic