Copy tree structure data and create same tree structure data using recursive loop in java
<p>I am dealing with one table on the database. The columns are: id, name, parent_id
(parent_id would be an id on the table. if parent_id is null, the record is a parent.)</p>

<p>What would be the best way to copy and create same record through recursive loop from recursive loop so I can create same tree structure as it is:</p>

<ul>
<li>item
<ul>
<li>item1
<ul>
<li>item 1.1
<ul>
<li>item 1.1.1</li>
<li>item 1.1.2</li>
</ul></li>
<li>item 1.2</li>
</ul></li>
<li>item 2
<ul>
<li>item 2.1
<ul>
<li>item 2.1.1</li>
</ul></li>
<li>item 2.2</li>
</ul></li>
<li>item3</li>
</ul></li>
</ul>

<p>etc and it is like nth level.</p>
