Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>When you are working with objects that are coming in from JSON or external representations you are always working with detached objects from Hibernate's perspective.</p> <p>It's been a while since I've done any serious hibernate, but if you are creating an object Hibernate doesn't know about you have to tell it by re-attaching the object with the session. It will then pull the information it needs from the database to associate it with the session, including any versioning information. This is referred to as a detached object because it was created outside of the Hibernate session, and Hibernate doesn't know if this object is a new object or an object that exists in the DB. You can re-attach objects with session.merge(someObject). You only need to reattach the parent btw. For a better explanation:</p> <p><a href="https://stackoverflow.com/questions/912659/what-is-the-proper-way-to-re-attach-detached-objects-in-hibernate">What is the proper way to re-attach detached objects in Hibernate?</a></p> <p>The version information is used for optimistic locking. So in a multi-client environment it's possible two request could modify the same object in the DB and it's your job as the programmer to order those modifications and make sure one doesn't overwrite the other. Optimistic locking is one way to do this where objects are given versions when someone modifies the object the version is incremented. However, before a new version is saved you have to check and make sure the object being given to the DB is the same version as the one stored in the DB. That makes sure that what mods you're about to save were done on the latest version stored in the DB. That means you can't overwrite the object with an old version of that object. Without that version information Hibernate can't performing optimistic locking.</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. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    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