If they are brought up together or if the cat or dog is used to small animals, then you may not have a problem. Most of the time though, cats and dogs view gerbils, hamsters, etc. as prey items.
I have two cats and a dog and they're all great together. If you introduce them when they're young it's best and you need cats with a boisterous personality and dogs that are more laid back are best....