Only the dirty properties will be set into the result CQL if the specified entity is a dirty marker entity.

@param entity
@return
480627
@SuppressWarnings("deprecation")
    public CQLBuilder set(final Object entity) {
        if (entity instanceof String) {
            return set(N.asArray((String) entity));
        } else if (entity instanceof Map) {
            return set((Map<String, Object>) entity);
        } else {
            this.entityClass = entity.getClass();

            if (N.isDirtyMarker(entity.getClass())) {
                final DirtyMarker dirtyMarkerEntity = ((DirtyMarker) entity);
                final Set<String> updatedPropNames = dirtyMarkerEntity.dirtyPropNames();
                final Map<String, Object> updateProps = new HashMap<>();

                for (String propName : updatedPropNames) {
                    updateProps.put(propName, ClassUtil.getPropValue(dirtyMarkerEntity, propName));
                }

                return set(updateProps);
            } else {
                return set(Maps.entity2Map(entity));
            }
        }
    }
160995
public static String buildEqualsWhere(Entity entity, List<Object> paramValues) {
		if (null == entity || entity.isEmpty()) {
			return StrUtil.EMPTY;
		}

		final StringBuilder sb = new StringBuilder(" WHERE ");
		boolean isNotFirst = false;
		for (Entry<String, Object> entry : entity.entrySet()) {
			if (isNotFirst) {
				sb.append(" and ");
			} else {
				isNotFirst = true;
			}
			sb.append("`").append(entry.getKey()).append("`").append(" = ?");
			paramValues.add(entry.getValue());
		}

		return sb.toString();
	}
382762
function(field, value) {
        if (field in this) {
            if (this.get(field) !== value && !([
                null,
                undefined
            ].indexOf(this.get(field)) > -1 && [
                null,
                undefined
            ].indexOf(value) > -1)) {
                if (CRUD.EntityManager.entities[this.getType()].autoSerialize.indexOf(field) > -1) {
                    if (JSON.stringify(this.get(field)) != JSON.stringify(value)) {
                        this.__dirtyValues__[field] = value;
                    }
                } else {
                    this.__dirtyValues__[field] = value;
                }
            }
        } else {
            CRUD.log('Could not find field \'' + field + '\' in \'' + this.getType() + '\' (for set)');
        }
    }
1137986
public T insert(T entity) {

        if (!hasPrimaryKey(entity)) {
            throw new RuntimeException(String.format("Tried to insert entity of type %s with null or zero primary key",
                    entity.getClass().getSimpleName()));
        }

        InsertCreator insert = new InsertCreator(table);

        insert.setValue(idColumn.getColumnName(), getPrimaryKey(entity));

        if (versionColumn != null) {
            insert.setValue(versionColumn.getColumnName(), 0);
        }

        for (Column column : columns) {
            if (!column.isReadOnly()) {
                insert.setValue(column.getColumnName(), getFieldValueAsColumn(entity, column));
            }
        }

        new JdbcTemplate(ormConfig.getDataSource()).update(insert);

        if (versionColumn != null) {
            ReflectionUtils.setFieldValue(entity, versionColumn.getFieldName(), 0);
        }

        return entity;
    }
297178
public GenericResponseBuilder<T> entity(T entity) {
    if (hasErrorEntity) {
      throw new IllegalStateException(
          "errorEntity already set. Only one of entity and errorEntity may be set");
    }
    this.body = entity;
    rawBuilder.entity(entity);
    return this;
  }
804297
public static String getQualifiedName(HasMetadata entity) {
    if (entity != null) {
      return "" + getNamespace(entity) + "/" + getName(entity);
    } else {
      return null;
    }
  }
1133022
@SuppressWarnings({"OverlyLongMethod"})
    public void clearProperties(@NotNull final PersistentStoreTransaction txn, @NotNull final Entity entity) {
        final Transaction envTxn = txn.getEnvironmentTransaction();
        final PersistentEntityId id = (PersistentEntityId) entity.getId();
        final int entityTypeId = id.getTypeId();
        final long entityLocalId = id.getLocalId();
        final PropertiesTable properties = getPropertiesTable(txn, entityTypeId);
        final PropertyKey propertyKey = new PropertyKey(entityLocalId, 0);
        try (Cursor cursor = getPrimaryPropertyIndexCursor(txn, properties)) {
            for (boolean success = cursor.getSearchKeyRange(PropertyKey.propertyKeyToEntry(propertyKey)) != null;
                 success; success = cursor.getNext()) {
                ByteIterable keyEntry = cursor.getKey();
                final PropertyKey key = PropertyKey.entryToPropertyKey(keyEntry);
                if (key.getEntityLocalId() != entityLocalId) {
                    break;
                }
                final int propertyId = key.getPropertyId();
                final ByteIterable value = cursor.getValue();
                final PropertyValue propValue = propertyTypes.entryToPropertyValue(value);
                txn.propertyChanged(id, propertyId, propValue.getData(), null);
                properties.deleteNoFail(txn, entityLocalId, value, propertyId, propValue.getType());
            }
        }
    }
276319
public <T> void evict(T entity) {
        DocumentInfo documentInfo = documentsByEntity.get(entity);
        if (documentInfo != null) {
            documentsByEntity.remove(entity);
            documentsById.remove(documentInfo.getId());
        }

        deletedEntities.remove(entity);
        if (_countersByDocId != null) {
            _countersByDocId.remove(documentInfo.getId());
        }
    }
411030
public X getPrimaryID(T entity) {
		if(mappingContext == null || conversionService == null) {
			fetchMappingContextAndConversionService();
		}

		MongoPersistentEntity<?> persistentEntity = mappingContext.getPersistentEntity(entity.getClass());
		MongoPersistentProperty idProperty = persistentEntity.getIdProperty();
		if(idProperty == null) {
			return null;
		}
		
//		X idValue = BeanWrapper.create(entity, conversionService).getProperty(idProperty, this.primaryIDClass);
		X idValue = (X) this.mappingContext.getPersistentEntity(this.entityClass).getPropertyAccessor(entity).getProperty(idProperty);
		return idValue;
	}
234066
public boolean isValidEntityObject(Object entity, EntityMetadata metadata)
    {
        if (entity == null)
        {
            log.error("Entity to be persisted must not be null, operation failed");
            return false;
        }

        Object id = PropertyAccessorHelper.getId(entity, metadata);
        if (id == null)
        {
            log.error("Entity to be persisted can't have Primary key set to null.");
            throw new IllegalArgumentException("Entity to be persisted can't have Primary key set to null.");
            // return false;
        }
        return true;
    }
589796
public SqlBuilder update(Entity entity) {
		// 验证
		validateEntity(entity);

		if (null != wrapper) {
			// 包装表名
			// entity = wrapper.wrap(entity);
			entity.setTableName(wrapper.wrap(entity.getTableName()));
		}

		sql.append("UPDATE ").append(entity.getTableName()).append(" SET ");
		String field;
		for (Entry<String, Object> entry : entity.entrySet()) {
			field = entry.getKey();
			if (StrUtil.isNotBlank(field)) {
				if (paramValues.size() > 0) {
					sql.append(", ");
				}
				this.fields.add(field);
				sql.append((null != wrapper) ? wrapper.wrap(field) : field).append(" = ? ");
				this.paramValues.add(entry.getValue());// 更新不对空做处理，因为存在清空字段的情况
			}
		}

		return this;
	}
40808
public static boolean isFetched(final Object entity) {
        return entity == null || !isProxy(entity) || asProxy(entity).__isFetched();
    }
870611
@Override
    public Long get(Entity entity) {
        Objects.requireNonNull(entity, "entity cannot be null");
        // return id()
        return entity.id();
    }
223655
@Override
	public boolean matches(Object entity) {
		T t = property.get(entity);
		
		for (T value : values) {
			if (t.compareTo(value) == 0) {
				return true;
			}
		}
		
		return false;
	}
877842
private SQLQuery query(Class<?>... entity) {
		SQLQuery q = session.createSQLQuery(sql);
		if (entity.length == 1) {
			q.addEntity(entity[0]);
		}
		for (Map.Entry<String, Type> scalar : scalars.entrySet()) {
			q.addScalar(scalar.getKey(), scalar.getValue());
		}
		for (int i = 0; i < positionedParameters.length; i++) {
			q.setParameter(i, positionedParameters[i]);
		}
		for (Map.Entry<String, Object> entry : namedParameters.entrySet()) {
			Object value = entry.getValue();
			if (Types.isArray(value)) {
				Object[] parameter = (Object[]) value;
				if (parameter.length == 0) {
					throw new HibernateException(String.format("Invalid named parameter |%s|. Empty array.", entry.getKey()));
				}
				q.setParameterList(entry.getKey(), parameter);
			} else if (Types.isCollection(value)) {
				Collection<?> parameter = (Collection<?>) value;
				if (parameter.isEmpty()) {
					throw new HibernateException(String.format("Invalid named parameter |%s|. Empty list.", entry.getKey()));
				}
				q.setParameterList(entry.getKey(), parameter);
			} else {
				q.setParameter(entry.getKey(), value);
			}
		}
		if (offset > 0) {
			q.setFirstResult(offset);
		}
		if (rowsCount > 0) {
			q.setMaxResults(rowsCount);
		}
		return q;
	}
834704
public boolean updateEntity(Entity entity) {
        String entityName = entity.getName();
        checkEntityIsEmpty(entityName);
        QueryPart<Entity> queryPart = new Query<Entity>("entities")
                .path(entityName, true);
        return httpClientManager.updateMetaData(queryPart, patch(entity));
    }
538723
@Override
	public boolean filter(Object entity) {
		if (fixture instanceof FilterableFixture) {
			return filterableFixture().filter(entity);
		}

		return true;
	}