TreeTable data displaying wrong

So here is the issue: I am trying to display a list of categories for a website on an entity browser screen. Some categories have sub-categories and some of the sub-categories have sub-categories and so on. The problem is that any branches that go more than two layers deep seem to break it (see pictures below). I anyone has an idea as to what the problem is, it would be much appreciated. I have been able to confirm through several other ways that my data is in fact correct. it simply gets messed up when I try to display it. Here also is the xml for the screen in question.

You might notice from the pictures that when it messes things up, one category will be repeated a bunch of times, and the rest of the categories that should be in the list disappear. I hope this is enough to go on.

Screenshot 2021-08-13 113259
Screenshot 2021-08-13 113230
Screenshot 2021-08-13 113138

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<data readOnly="true">

    <collection id="categoryDc"
                class="com.delta.shift4shopmanager.entity.CategoryDTO" fetchPlan="_base">
        <loader id="categoryDL">
            <query>
                <![CDATA[all]]>
            </query>
        </loader>
    </collection>

</data>

<facets>
    <dataLoadCoordinator auto="true"/>
    <screenSettings id="settingsFacet" auto="true"/>
</facets>

<actions>
    <action id="lookupSelectAction"
            caption="msg:///actions.Select"
            icon="LOOKUP_OK"
            primary="true"
            shortcut="${COMMIT_SHORTCUT}"/>
    <action id="lookupCancelAction"
            caption="msg:///actions.Cancel"
            icon="LOOKUP_CANCEL"/>
</actions>

<dialogMode height="100"
            width="800"/>

<layout spacing="true">

    <treeTable id="departmentsTable"
               hierarchyProperty="parentDTO"
               width="100%"
               dataContainer="categoryDc">
        <columns>
            <column id="name"/>
            <column id="categoryID"/>
            <column id="parentDTO"/>
        </columns>
    </treeTable>

    <hbox id="lookupActions" spacing="true" visible="false">
        <button action="lookupSelectAction"/>
        <button action="lookupCancelAction"/>
    </hbox>

</layout>

Ok. Turns out there was a fluke in my code that was, in fact, making duplicate entities. Just a note, Trees and TreeTables do not handle duplicates very well. There was only one duplicate per error, and the TreeTable still showed a lot more than two. The Tree broke if you tried expanding one of the duplicates. Once expanded, none of the expand/close actions worked. Just thought I’d throw that out there.