/** * Creates a snapshot of the entity. * * @since 2.0.0 */ private void snapshot() { ManagedInstance.LOG.trace("Snapshot generated for instance {0}", this); if (this.snapshot.size() == 0) { for (final AbstractMapping<?, ?, ?> mapping : this.type.getMappingsSingular()) { this.snapshot.put(mapping, mapping.get(this.instance)); } } }
/** * Returns if attribute name <code>attributeNaöe</code> has been loaded. * * @param attributeName the name of the attribute * @return true if join is loaded, false otherwise * @since 2.0.0 */ public boolean isJoinLoaded(String attributeName) { final AbstractMapping<?, ?, ?> mapping = this.type.getRootMapping().getMapping(attributeName); if ((mapping instanceof BasicMappingImpl) || (mapping instanceof EmbeddedMappingImpl)) { return true; } if (((AssociationMappingImpl<?, ?, ?>) mapping).isEager()) { return true; } return this.joinsLoaded.contains(mapping.getPath()); }
private boolean checkUpdatedImpl() { // iterate over old values for (final AbstractMapping<?, ?, ?> mapping : this.type.getMappingsSingular()) { final Object newValue = mapping.get(this.instance); final Object oldValue = this.snapshot.get(mapping); // if it is changed then mark as changed and bail out if (mapping.getAttribute().getPersistentAttributeType() == PersistentAttributeType.BASIC) { if (!ObjectUtils.equals(oldValue, newValue)) { return true; } continue; } if (oldValue != newValue) { return true; } } return false; }