Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is from section <a href="http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/objectstate.html" rel="noreferrer">10.7. Automatic state detection</a> of the Hibernate Reference Documentation:</p> <blockquote> <p>saveOrUpdate() does the following:</p> <ul> <li>if the object is already persistent in this session, do nothing</li> <li>if another object associated with the session has the same identifier, throw an exception</li> <li>if the object has no identifier property, save() it</li> <li>if the object's identifier has the value assigned to a newly instantiated object, save() it</li> <li>if the object is versioned (by a &lt;version&gt; or &lt;timestamp&gt;), and the version property value is the same value assigned to a newly instantiated object, save() it</li> <li>otherwise update() the object</li> </ul> <p>and merge() is very different:</p> <ul> <li>if there is a persistent instance with the same identifier currently associated with the session, copy the state of the given object onto the persistent instance</li> <li>if there is no persistent instance currently associated with the session, try to load it from the database, or create a new persistent instance</li> <li>the persistent instance is returned</li> <li>the given instance does not become associated with the session, it remains detached</li> </ul> </blockquote> <p>You should use Merge() if you are trying to update objects that were at one point detached from the session, especially if there might be persistent instances of those objects currently associated with the session. Otherwise, using SaveOrUpdate() in that case would result in an exception.</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