code: private boolean removeKunderaProxies(EntityMetadata metadata, Object entity, List<RelationHolder> relationHolders)
      {
          boolean proxyRemoved = false;
  
          for (Relation relation : metadata.getRelations())
          {
              if (relation != null && relation.isUnary())
              {
                  Object relationObject = PropertyAccessorHelper.getObject(entity, relation.getProperty());
                  if (relationObject != null && ProxyHelper.isKunderaProxy(relationObject))
                  {
                      EntityMetadata relMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata,
                              relation.getTargetEntity());
                      Method idAccessorMethod = relMetadata.getReadIdentifierMethod();
                      Object foreignKey = null;
                      try
                      {
                          foreignKey = idAccessorMethod.invoke(relationObject, new Object[] {});
                      }
                      catch (IllegalArgumentException e)
                      {
                          log.error("Error while Fetching relationship value of {}, Caused by {}.",
                                  metadata.getEntityClazz(), e);
                      }
                      catch (IllegalAccessException e)
                      {
                          log.error("Error while Fetching relationship value of {}, Caused by {}.",
                                  metadata.getEntityClazz(), e);
                      }
                      catch (InvocationTargetException e)
                      {
                          log.error("Error while Fetching relationship value of {}, Caused by {}.",
                                  metadata.getEntityClazz(), e);
                      }
  
                      if (foreignKey != null)
                      {
                          relationObject = null;
                          PropertyAccessorHelper.set(entity, relation.getProperty(), relationObject);
                          relationHolders
                                  .add(new RelationHolder(relation.getJoinColumnName(kunderaMetadata), foreignKey));
                          proxyRemoved = true;
                      }
                  }
              }
          }
          return proxyRemoved;
      }
docs: Removes the kundera proxies.
  
  @param metadata
  the metadata
  @param entity
  the entity
  @param relationHolders
  the relation holders
  @return true, if successful