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="" fetchPlan="_base">
        <loader id="categoryDL">


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

    <action id="lookupSelectAction"
    <action id="lookupCancelAction"

<dialogMode height="100"

<layout spacing="true">

    <treeTable id="departmentsTable"
            <column id="name"/>
            <column id="categoryID"/>
            <column id="parentDTO"/>

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


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.