Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's my understanding of the methods. Mainly these are based on the <a href="http://www.hibernate.org/hib_docs/v3/api/org/hibernate/Session.html" rel="noreferrer">API</a> though as I don't use all of these in practice.</p> <p><strong>saveOrUpdate</strong> Calls either save or update depending on some checks. E.g. if no identifier exists, save is called. Otherwise update is called.</p> <p><strong>save</strong> Persists an entity. Will assign an identifier if one doesn't exist. If one does, it's essentially doing an update. Returns the generated ID of the entity.</p> <p><strong>update</strong> Attempts to persist the entity using an existing identifier. If no identifier exists, I believe an exception is thrown.</p> <p><strong>saveOrUpdateCopy</strong> This is deprecated and should no longer be used. Instead there is...</p> <p><strong>merge</strong> Now this is where my knowledge starts to falter. The important thing here is the difference between transient, detached and persistent entities. For more info on the object states, <a href="http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/objectstate.html" rel="noreferrer">take a look here</a>. With save &amp; update, you are dealing with persistent objects. They are linked to a Session so Hibernate knows what has changed. But when you have a transient object, there is no session involved. In these cases you need to use merge for updates and persist for saving.</p> <p><strong>persist</strong> As mentioned above, this is used on transient objects. It does not return the generated ID.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload