Showing a complex hierarchy

Hello. Is there any solution for showing a hierarchical property from the other entity? Let me give an example: I have a SparePart, which could contain other SparePart's, but has a certain amount of them, so I create a SparePart entity with two lists parents and children inside. Also i create a SparePartEntry with has a link to a parent a link to a child and a field amount. I want to show a hierarchy of SpareParts with amounts, how could i achieve this?