Qt 4.8.4, Firebird 2.5.

I have code like this:
Qt Code:
  1. // model - QSqlRelationalTableModel
  2. if( model->database().transaction() )
  3. {
  4. int indexDialog;
  5.  
  6. if( _index == 0 )
  7. {
  8. model->insertRow( model->rowCount() );
  9. indexDialog = model->index( model->rowCount() - 1, 0 ).row();
  10. }
  11. else
  12. {
  13. indexDialog = _index;
  14. }
  15.  
  16. DokumentDialog dialog( model, indexDialog, this );
  17. if( dialog.exec() == QDialog::Accepted )
  18. {
  19. if( dialog.submit() )// call mapper->submit();
  20. {
  21. if( model->database().commit() )
  22. {
  23. qDebug() << BOOST_CURRENT_FUNCTION;
  24. qDebug() << "\ttransaction successful commit";
  25. }
  26. else
  27. {
  28. qDebug() << BOOST_CURRENT_FUNCTION;
  29. qDebug() << "\ttransaction faild to commit";
  30. qDebug() << "\t" << model->lastError().text();
  31.  
  32. model->database().rollback();
  33. model->revert();
  34. }
  35. }
  36. else
  37. {
  38. qDebug() << BOOST_CURRENT_FUNCTION;
  39. qDebug() << "\tsubmit from mapper error";
  40. qDebug() << "\t" << model->lastError().text();
  41.  
  42. model->database().rollback();
  43. model->revert();
  44. }
  45. }
  46. else
  47. {
  48. model->database().rollback();
  49. model->revert();
  50. }
  51. }
To copy to clipboard, switch view to plain text mode 

First insert/update is ok. Second and next returns me an error:
Qt Code:
  1. submit from mapper error
  2. "invalid transaction handle (expecting explicit transaction start) Unable to execute query"
To copy to clipboard, switch view to plain text mode 
When I comment transaction, commit, rollback then insert and updates works ok, but I want to solve transaction issue.