Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Persistence message

 
Jorge Coll
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


I'm not sure about what's the correct message to invoke the persistence of an entity in my sequence diagrams. I'm using the Cade/Sheil model in which the persistence is realized by an invocation message "persist" to EntityManager (JPA).

My questions are...
  • If the object (maybe) already persisted... I must use another message like "merge"?
  • Can I use "persist" as a generic method for new or already existing objects?
  • I must use notes in these cases?
  • I must use conditional structures in this cases?


  • Maybe one item could answer the others.


    Thanks,
    Jorge
     
    kumar naresh
    Ranch Hand
    Posts: 120
    1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Check with the object Id with that of database Id if it is available you will get entity object and on the entity object use merge, if it is not available create the object, send it as persists to create a new.
     
    Jorge Coll
    Greenhorn
    Posts: 8
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks Kumar!

    I know that these steps are programatically corrects without any doubt but I'm thinking that put all this logic together in the sequence diagrams could be a little excesive.

    Mr. Cade tell us: "Another common mistake (in all diagrams, not just the class diagram) is to focus on the 'how' and not the 'what'".

    I try to put this kind of programatic persistence logic on my sequence diagrams and the result looks very 'dirty'.

    I don't know if will be possible to put something like "persist/merge" over the sequence diagrams arrows and left the low level coding details outside.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic