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 ?
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.
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.
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?