[DBTablesMonitoring] Use a new code fashion to do transaction.

This commit replaces methods that call addHostgroupElementWithoutTransaction().