In my previous post we have seen to implement self reference (Bi-directional) . Today we will quickly see how to achieve self reference uni-directional.
Lets take a simple scenario of a tree structure . One node can have many Children nodes but any child node will have only one parent.
Now we do not have any mapping table because we want it unidirectional mapping. In database we have only one table Node . Lets see how to get complete tree now ..
Above mapping will create the below realtion
You can refer below link for more details :
You can download complete implementation from here