How to save the objects in a Loop in HIbernate?
<p>I am trying to save the objects i the Loop but its not working, Initially its insert the row in the table and then same row is updated for every loop.</p>

<p>PFB my code.</p>

<pre><code>@Override
    public void saveConfirmDisposalAction(ConfirmDisposalAction confirmDisposal, List&lt;Long&gt; objectIDList) {
        for(ObjectCommon objectCommon : getObjectList(objectIDList)){
            confirmDisposal.setObjectId(objectCommon);
            confirmDisposal.setStorageLocation(objectCommon.getStorageLocation());
            objectActionService.saveObjectAction(confirmDisposal);
        }
    }
</code></pre>

<p>from getObjectList method, I am getting list of objects from database and iterate in the loop.
when I tried to save object of ConfirmDisposalAction model then only one row insert and the same row will update later on.</p>

<p>Kindly let me know, How I can fix this issue?</p>

<p>Appreciate for help :)</p>