You should put a rollback instruction in the catch section.
Daniele Yuvraj Shinde wrote:
public void saveAllRecords( String id, List recordList )
{
try
{
getSession().startTransaction();
if (!recordList.isEmpty())
{
for (int i = 0; i < recordList.size();
i++)
{
BasicDTO basicDTO = (BasicDTO)
recordList.get(i);
getSession().insert(id +"_INSERT",
basicDTO);
}
}
getSession().commitTransaction();
}
catch (SQLException e)
{
throw new RuntimeException("Error while
Excecuting Batch" + e);
}
finally
{
try
{
getSession().endTransaction();
}
catch (SQLException e)
{
throw new RuntimeException("Error while
Excecuting Batch" + e);
}
}
}
