Refactor SQLDao to use template inheritance