Hmm, i'm not sure that i understood you. You suppose that the insert in sessionlog doesn't returns the correct id but 0, which causes the 0 in the successesive inserts into commitlog and historylog? Olaf P.S.: Just out of curiosity: Which (serious) databases doesn't support referential integrity?