Set null parent.
This method would unset the lazy loading records before setting it.
Don't forget save model after setting it.
420317
public function setNullParent()
    {
        if ($this->hasParent()) {
            unset($this->parent->children);
        }
        unset($this->parent);
        $this->setParentId(static::$nullParent);
    }
853032
@Override
  public void setParent(Logger parent)
  {
    if (parent.equals(_parent))
      return;
    
    super.setParent(parent);

    if (parent instanceof EnvironmentLogger) {
      _parent = (EnvironmentLogger) parent;

      _parent.addChild(this);
    }
    
    updateEffectiveLevel(_systemClassLoader);
  }
928791
public void setParent( IVarDef parent)
    {
    super.setParent( parent);

    // Reset ancestry for all descendants.
    if( members_ != null)
      {
      for( IVarDef member : members_)
        {
        member.setParent( this);
        }
      }
    }
572832
public void reset()
    {
        m_currentValue = null;
        useCurrentValue(false);
        setDerived(false);
        m_notKnown = false;
        setUnknown(m_lastUnknown);
    }
1169517
public void initialise(XMLReader reader, AbstractGpxParserDefault parent) {
        setReader(reader);
        setParent(parent);
        setContentBuffer(parent.getContentBuffer());
        setWptPreparedStmt(parent.getWptPreparedStmt());
        setElementNames(parent.getElementNames());
        setCurrentPoint(parent.getCurrentPoint());
    }
627384
public function setParent($parent)
	{
		if ($parent instanceof JCategoryNode || is_null($parent))
		{
			if (!is_null($this->_parent))
			{
				$key = array_search($this, $this->_parent->_children);
				unset($this->_parent->_children[$key]);
			}

			if (!is_null($parent))
			{
				$parent->_children[] = & $this;
			}

			$this->_parent = $parent;

			if ($this->id != 'root')
			{
				if ($this->parent_id != 1)
				{
					$this->_path = $parent->getPath();
				}

				$this->_path[] = $this->id . ':' . $this->alias;
			}

			if (count($parent->_children) > 1)
			{
				end($parent->_children);
				$this->_leftSibling = prev($parent->_children);
				$this->_leftSibling->_rightsibling = & $this;
			}
		}
	}
970390
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (this.getOwner() != null)
        {
            InitFieldHandler behavior = (InitFieldHandler)this.getOwner().getListener(InitFieldHandler.class.getName());
            if (this.getOwner().getRecord().getEditMode() == DBConstants.EDIT_CURRENT)
                behavior = null;    // Special case - if there is a current record, make sure initonce works.
            if (behavior != null)
                this.setFirstTime(false);  // If InitFieldHandler already set the initial value, don't set the first time.
        }
    }
520669
public void init(Object parent, Object record)
    {
        m_parent = parent;
        this.setOpaque(false);
        
        if (this.getBaseApplet() != null)
        {
            String strScreenDesc = this.getScreenDesc();
            this.getBaseApplet().setStatusText(strScreenDesc);   // Display screen desc or clear screen desc.
            if (strScreenDesc != null)
                if (this.getTargetScreen(JBaseFrame.class) != null)
                    ((JBaseFrame)this.getTargetScreen(JBaseFrame.class)).setTitle(strScreenDesc);
        }
    }
547993
public void init(Object parent, Object record)
    {
        super.init(parent, record);
        this.setOpaque(false);
        this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
        this.addButtons();
    }
1203821
public void setParent(HierarchicalFormModel parent) {
		Assert.notNull(parent, "parent");
		this.parent = parent;
		this.parent.addPropertyChangeListener(ENABLED_PROPERTY, parentStateChangeHandler);
		this.parent.addPropertyChangeListener(READONLY_PROPERTY, parentStateChangeHandler);
		enabledUpdated();
		readOnlyUpdated();
	}
41829
public void init(Object parent, Object strURL)
    {
        BaseApplet applet = null;
        if (parent instanceof BaseApplet)
            applet = (BaseApplet)parent;
        if (strURL instanceof BaseApplet)
            applet = (BaseApplet)strURL;
        if (applet == null)
            applet = this.getBaseApplet();

        if (strURL == null)
        	if (applet != null)
        		if (applet.getProperty(Params.URL) == null)
        			strURL = "?" + Params.HELP + "=";

        this.setOpaque(false);
        super.init(parent, strURL);

        if (parent instanceof BaseApplet)
        	((BaseApplet)parent).setHelpView(this.getHtmlEditor());
    }
1279859
public void init(Object parent, Object record)
    {
        super.init(parent, record);

        this.addSubPanels(this);
        
        if (this.getBaseApplet() != null)
            if (this.getBaseApplet().getProperty(Constants.OBJECT_ID) != null)
                if (this.getFieldList() != null)
                    if ((this.getFieldList().getEditMode() == Constants.EDIT_NONE) || (this.getFieldList().getEditMode() == Constants.EDIT_ADD))
        {
            FieldInfo field = this.getFieldList().getCounterField();
            field.setString(this.getBaseApplet().getProperty(Constants.OBJECT_ID));
            this.readKeyed(field);
        }
        this.fieldsToControls();
    }
880347
public void init(RecordOwner recordOwner)
    {
        m_dbEditMode = Constants.EDIT_NONE;
        m_listener = null;
        m_bDisplayOption = true;

        m_depScreens = null;        // List of all Dependent screens (doesn't include m_recordOwner)
        m_recordOwner = recordOwner;
        this.getTable();    // This will set up a table using the recordowner if it exists.

        if (recordOwner != null)
            recordOwner.addRecord(this, false);

        super.init(recordOwner);    // Set up the fields.
        this.selectFields();
        if ((this.getDatabaseType() & DBConstants.BASE_TABLE_CLASS) != 0)
        {
            if ((this.getDatabaseType() & DBConstants.SHARED_TABLE) != 0)  // But not shared (don't need multitable).
            {
                if ((this.getMasterSlave() & RecordOwner.MASTER) != 0)   // Slaves don't need this helper class.
                {
                    if ((this.getRecordOwner() == null)
                        || ((this.getRecordOwner().getMasterSlave() & RecordOwner.MASTER) != 0))
                            new org.jbundle.base.db.shared.SharedBaseRecordTable(null, this);    // Special - base class of a shared table
                }
            }
            else
                new org.jbundle.base.db.shared.MultiTable(null, this);     // Special - base class - Add the overriding classes.
        }
        if (this.getTable() != null)
            if (this.getTable().getDatabase() != null)
                if (this.getTable().getDatabase().getDatabaseOwner() != null)
                if (this.getTable().getDatabase().getDatabaseOwner().getEnvironment() != null)
                if ((DBConstants.YES.equalsIgnoreCase(((Environment)this.getTable().getDatabase().getDatabaseOwner().getEnvironment()).getProperty(DBParams.LOG_TRXS))) || (DBConstants.TRUE.equalsIgnoreCase(((Environment)this.getTable().getDatabase().getDatabaseOwner().getEnvironment()).getProperty(DBParams.LOG_TRXS))))
            if ((this.getMasterSlave() & RecordOwner.SLAVE) != 0)   // Slaves do the logging.
                if ((this.getDatabaseType() & DBConstants.DONT_LOG_TRX) == 0)
        {
            if ((this.getRecordOwner() == null)
                || ((this.getRecordOwner().getMasterSlave() & RecordOwner.SLAVE) != 0))
                    new org.jbundle.base.db.util.log.MessageLogTable(null, this);    // Special - base class of a shared table
        }
        m_iDefaultOrder = Constants.MAIN_KEY_AREA;      // Key Area to use on next operation
        this.addListeners();
    }
484548
protected void onRemoveParentObject(GVRSceneObject parent) {
        for (GVRComponent comp : mComponents.values()) {
            comp.onRemoveOwnersParent(parent);
        }
    }
4410
void setParent (Context2 parent)
    {
        this.parent = parent;
        parent.child = this;        // JJK: Doubly-linked
        declarations = null;
        prefixTable = parent.prefixTable;
        uriTable = parent.uriTable;
        elementNameTable = parent.elementNameTable;
        attributeNameTable = parent.attributeNameTable;
        defaultNS = parent.defaultNS;
        tablesDirty = false;
    }
810168
void setParent(JMFMessageData parent) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            JmfTr.entry(this, tc, "setParent", new Object[] { parent });

        synchronized (getMessageLockArtefact()) {

            // If the parent is a JSMessageData then this is straight forward
            if (parent instanceof JSMessageData) {
                parentMessage = (JSMessageData) parent;
                master = ((JSMessageData) parent).master;
                containingMessage = ((JSMessageData) parent).compatibilityWrapperOrSelf;
            }

            // ... if not, it must be a JSCompatibleMessageImpl, and its encoding must
            // be a JSMessageData, because if it was a JMFEncapsulation it couldn't be our parent
            else {
                JSMessageData msg = (JSMessageData) ((JSCompatibleMessageImpl) parent).getEncodingMessage();
                parentMessage = msg;
                master = msg.master;
                containingMessage = parent;
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            JmfTr.exit(this, tc, "setParent");
    }
330834
public static void lazyInsertBefore(Element parent, Element child, Element before) {
        if (!parent.contains(child)) {
            parent.insertBefore(child, before);
        }
    }