Allows checking whether the provided entity is present in the cache
and is {@link DbEntityState#TRANSIENT}.

@param dbEntity the entity to check
@return true if the provided entity is present in the cache and is
{@link DbEntityState#TRANSIENT}.
481495
public boolean isTransient(DbEntity dbEntity) {
    CachedDbEntity cachedDbEntity = getCachedEntity(dbEntity);
    if(cachedDbEntity == null) {
      return false;
    } else {
      return cachedDbEntity.getEntityState() == TRANSIENT;
    }
  }
1022875
private static boolean isSupportedEntity(Class<?> entityType) {
        try {
            Annotation annotation = entityType.getAnnotation(Serializer.class);
            if (annotation != null) {
                return true;
            }
        } catch (Throwable th) {
            LOGGER.warn("Exception in checking for annotations", th);
        }
        return false;
    }
737987
public boolean hasPrevious() throws DBException
    {
        if (m_iCurrentRecord >= m_iRecordsAccessed)
            return true;
        Object record = this.previous();
        if (record == null)
            return false;
        else
        {
            m_iRecordsAccessed--;   // Offically this record has not been accessed
            return true;
        }
    }
248793
public IBasicEntity get(EntityIdentifier entityID) throws CachingException {
        return EntityCachingServiceLocator.getEntityCachingService()
                .get(entityID.getType(), entityID.getKey());
    }
602523
public boolean deleteEntity(Entity entity) {
        String entityName = entity.getName();
        checkEntityIsEmpty(entityName);
        QueryPart<Entity> queryPart = new Query<Entity>("entities")
                .path(entityName, true);
        return httpClientManager.updateMetaData(queryPart, delete());
    }
829506
@GetMapping(value = "/{entityTypeId}/exist", produces = APPLICATION_JSON_VALUE)
  public boolean entityExists(@PathVariable("entityTypeId") String entityTypeId) {
    return dataService.hasRepository(entityTypeId);
  }
927493
public boolean containsEntityEntry(String entityName) {
        if (StringUtils.isBlank(entityName)) {
            throw new IllegalArgumentException("entityName cannot be null or empty.");
        }
        return entries.containsKey(entityName);
    }
962349
function isEntity(string $classFQCN) : bool
    {
        if ( ! class_exists($classFQCN)) {

            throw new ClassNotFoundException(sprintf('Given class FQCN "%s" does not exist.', $classFQCN));
        }

        if ( ! is_object($classFQCN)) {

            throw new EntityNotFoundException(sprintf('Given class "%s" is not a Doctrine Entity.', $classFQCN));
        }

        return ! $this->getObjectManager()
                      ->getMetadataFactory()
                      ->isTransient(ClassUtils::getClass($classFQCN));
    }
536037
public boolean createOrReplaceEntity(Entity entity) {
        String entityName = entity.getName();
        checkEntityIsEmpty(entityName);
        QueryPart<Entity> queryPart = new Query<Entity>("entities")
                .path(entityName, true);
        return httpClientManager.updateMetaData(queryPart, put(entity));
    }
1291687
@Override
  public Entity findOneById(Object id) {
    if (cacheable
        && !transactionInformation.isEntireRepositoryDirty(getEntityType())
        && !transactionInformation.isEntityDirty(EntityKey.create(getEntityType(), id))) {
      return l2Cache.get(delegate(), id);
    }
    return delegate().findOneById(id);
  }
516457
public static boolean isSingletonEntity(EntityDataModel entityDataModel, Object entity) throws ODataEdmException {
        // Get the entity type
        EntityType entityType = getAndCheckEntityType(entityDataModel, entity.getClass());
        boolean isSingletonEntity = false;

        for (Singleton singleton : entityDataModel.getEntityContainer().getSingletons()) {
            if (singleton.getTypeName().equals(entityType.getFullyQualifiedName())) {
                isSingletonEntity = true;
                break;
            }
        }

        return isSingletonEntity;
    }
1272214
public void setDeleted(DbEntity dbEntity) {
    CachedDbEntity cachedEntity = getCachedEntity(dbEntity);
    if(cachedEntity != null) {
      if(cachedEntity.getEntityState() == TRANSIENT) {
        cachedEntity.setEntityState(DELETED_TRANSIENT);

      } else if(cachedEntity.getEntityState() == PERSISTENT){
        cachedEntity.setEntityState(DELETED_PERSISTENT);

      } else if(cachedEntity.getEntityState() == MERGED){
        cachedEntity.setEntityState(DELETED_MERGED);
      }
    } else {
      // put a deleted merged into the cache
      CachedDbEntity cachedDbEntity = new CachedDbEntity();
      cachedDbEntity.setEntity(dbEntity);
      cachedDbEntity.setEntityState(DELETED_MERGED);
      putInternal(cachedDbEntity);

    }
  }
1035822
public void refresh(Object entity)
    {
        if (contains(entity))
        {
            MainCache mainCache = (MainCache) getPersistenceCache().getMainCache();
            Node node = mainCache.getNodeFromCache(entity, getMetadata(entity.getClass()), this);
            // Locking as it might read from persistence context.

            try
            {
                lock.readLock().lock();
                node.setPersistenceDelegator(this);
                node.refresh();
            }
            finally
            {
                lock.readLock().unlock();
            }
        }
        else
        {
            throw new IllegalArgumentException("This is not a valid or managed entity, can't be refreshed");
        }
    }
996513
public void addEntity(Entity entity){
		boolean delayed = updating || familyManager.notifying();
		entityManager.addEntity(entity, delayed);
	}
1226617
public boolean atEquivalentLocation(EntityFeature that) {
        return getEntityFeatureOf() != null &&
                getEntityFeatureOf().isEquivalent(that.getEntityFeatureOf()) &&
                getFeatureLocation() != null &&
                getFeatureLocation().isEquivalent(that.getFeatureLocation());
    }
824171
@Override
  protected void deleteEntity(DbEntityOperation operation) {

    final DbEntity dbEntity = operation.getEntity();

    // get statement
    String deleteStatement = dbSqlSessionFactory.getDeleteStatement(dbEntity.getClass());
    ensureNotNull("no delete statement for " + dbEntity.getClass() + " in the ibatis mapping files", "deleteStatement", deleteStatement);

    LOG.executeDatabaseOperation("DELETE", dbEntity);

    // execute the delete
    int nrOfRowsDeleted = executeDelete(deleteStatement, dbEntity);
    operation.setRowsAffected(nrOfRowsDeleted);

    // It only makes sense to check for optimistic locking exceptions for objects that actually have a revision
    if (dbEntity instanceof HasDbRevision && nrOfRowsDeleted == 0) {
      operation.setFailed(true);
      return;
    }

    // perform post delete action
    entityDeleted(dbEntity);
  }
1296253
public function save(AbstractDbEntity $dbEntity)
    {
        if ($dbEntity->shouldBeDeletedFromDbOnSave()) {
            // Only delete if previously saved to db
            if ($dbEntity->getPrimaryDbValue()) {
                $this->delete($dbEntity);
            }

            return false;
        }

        if ($dbEntity->shouldInsertOnDbSave()) {
            // Note that database data always contains all properties,
            // with defaults for non set properties
            $dataToSave = $dbEntity->getDbData();
        } else {
            if ($dbEntity->hasModifiedDbProperties()) {
                $dataToSave = $dbEntity->getModifiedDbData();
            } else {
                // Return if no value has been modified and it's not an insert
                // (we always want to insert if no id exist, since some child objects might
                // depend on the this primary id being available)
                return false;
            }
        }

        // Check data
        $sqlData = [];
        foreach ($dataToSave as $propertyName => $value) {
            if (!empty($value) && is_scalar($value)
                && $dbEntity->getDbPropertyMaxLength($propertyName)
                && mb_strlen($value) > $dbEntity->getDbPropertyMaxLength($propertyName)
            ) {
                throw new \RuntimeException(
                    "Database field \"{$propertyName}\" exceeds field max length (value: \"{$value}\")"
                );
            } elseif (empty($value) && $dbEntity->getDbPropertyNonEmpty($propertyName)) {
                throw new \RuntimeException("Database field \"{$propertyName}\" is empty and required");
            } elseif (((is_scalar($value) && ((string) $value) === '') || (!is_scalar($value) && empty($value)))
                && $dbEntity->getDbPropertyRequired($propertyName)
            ) {
                throw new \RuntimeException("Database field \"{$propertyName}\" is required to be set");
            }

            // Set data keys db field format
            $fieldName = $dbEntity->getDbFieldName($propertyName);
            $sqlData[$fieldName] = $value;
        }


        // Insert new database row
        if ($dbEntity->shouldInsertOnDbSave()) {
            $this->db->insert(
                $dbEntity->getDbTableName(),
                $sqlData
            );

            // Update entity with auto increment value
            if (!is_array($dbEntity->getPrimaryDbPropertyKey())
                && !empty($lastInsertId = $this->db->getLastInsertId())
            ) {
                $dbEntity->setPrimaryDbValue($lastInsertId);
            } else {
                // For entities with for example string primary keys, we update primary value
                // with value/values from db data, indicating that the entity is now
                // in database/loaded.
                $dbEntity->updatePrimaryDbValueFromDbData();
            }
        // Update existing database row
        } else {
            $this->db->update(
                $dbEntity->getDbTableName(),
                $sqlData,
                $this->getPrimaryKeyWhereSql($dbEntity),
                $this->getPrimaryKeyWhereParameters($dbEntity)
            );
        }

        $dbEntity->clearModifiedDbProperties();
        $dbEntity->setForceDbInsertOnSave(false);

        return true;
    }