code: private static Set<EntityTypeNode> expandEntityTypeDependencies(EntityTypeNode entityTypeNode) {
      if (LOG.isTraceEnabled()) {
        LOG.trace(
            "expandEntityTypeDependencies(EntityTypeNode entityTypeNode) --- entity: [{}], skip: [{}]",
            entityTypeNode.getEntityType().getId(),
            entityTypeNode.isSkip());
      }
  
      if (!entityTypeNode.isSkip()) {
        // get referenced entities excluding entities of mappedBy attributes
        EntityType entityType = entityTypeNode.getEntityType();
        Set<EntityTypeNode> refEntityMetaSet =
            stream(entityType.getOwnAllAttributes())
                .filter(attribute -> isProcessableAttribute(attribute, entityType))
                .flatMap(
                    attr -> {
                      EntityTypeNode nodeRef =
                          new EntityTypeNode(attr.getRefEntity(), entityTypeNode.getStack());
                      Set<EntityTypeNode> dependenciesRef = expandEntityTypeDependencies(nodeRef);
                      dependenciesRef.add(nodeRef);
                      return dependenciesRef.stream();
                    })
                .collect(toCollection(HashSet::new));
  
        EntityType extendsEntityMeta = entityType.getExtends();
        if (extendsEntityMeta != null) {
          EntityTypeNode nodeRef = new EntityTypeNode(extendsEntityMeta, entityTypeNode.getStack());
  
          // Add extended entity to set
          refEntityMetaSet.add(nodeRef);
  
          // Add dependencies of extended entity to set
          Set<EntityTypeNode> dependenciesRef = expandEntityTypeDependencies(nodeRef);
          refEntityMetaSet.addAll(dependenciesRef);
        }
        return refEntityMetaSet;
      } else {
        return Sets.newHashSet();
      }
    }
docs: Returns whole tree dependencies of the given entity meta data.
  
  @param entityTypeNode entity meta data node
  @return dependencies of the entity meta data node