File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Persistence message 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 "Persistence message" Watch "Persistence message" New topic
Author

Persistence message

Jorge Coll
Greenhorn

Joined: Sep 02, 2011
Posts: 8
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

    Joined: Mar 12, 2011
    Posts: 117
        
        1
    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.


    OCMJEA 5 |
    http://sceacertification.blogspot.in/2011_12_01_archive.html
    Jorge Coll
    Greenhorn

    Joined: Sep 02, 2011
    Posts: 8
    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.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Persistence message
     
    Similar Threads
    Another wait is over! Passed II/III with 91%
    JDO vs Prevayler
    nullPointerException on entity manager methods
    Hybrid persistence layer ..?
    Passed SCBCD 5.0 :)