Use commit instead of flush in trigger