Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Hibernate does/can use bytecode generation (CGLIB) so that it knows a field is dirty as soon as you call the setter (or even assign to the field afaict).</p> <p>This immediately marks that field/object as dirty, but doesn't reduce the number of objects that need to be dirty-checked during flush. All it does is impact the implementation of <code>org.hibernate.engine.EntityEntry.requiresDirtyCheck()</code>. It <em>still</em> does a field-by-field comparison to check for dirtiness.</p> <p>I say the above based on a recent trawl through the source code (3.2.6GA), with whatever credibility that adds. Points of interest are:</p> <ul> <li><code>SessionImpl.flush()</code> triggers an <code>onFlush()</code> event.</li> <li><code>SessionImpl.list()</code> calls <code>autoFlushIfRequired()</code> which triggers an <code>onAutoFlush()</code> event. (on the tables-of-interest). That is, queries can invoke a flush. Interestingly, no flush occurs if there is no transaction.</li> <li>Both those events eventually end up in <code>AbstractFlushingEventListener.flushEverythingToExecutions()</code>, which ends up (amongst other interesting locations) at <code>flushEntities()</code>.</li> <li>That loops over every entity in the session (<code>source.getPersistenceContext().getEntityEntries()</code>) calling <code>DefaultFlushEntityEventListener.onFlushEntity()</code>.</li> <li>You eventually end up at <code>dirtyCheck()</code>. That method does make some optimizations wrt to CGLIB dirty flags, but we've still ended up looping over every entity.</li> </ul>
    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