generate: use transaction handling to give a speed boost

Use transaction handling to speed up record creation (especially for relational db's)