The training to "behave appropriately" is essentially the same as training any dog around any source of interest.
Right from early on (ie, well before sexual maturity) follow the dog training guidelines and consider socialised training (classes etc) so that he really fully learns the Sit, Stay, Leave, Down, Calm etc.
If you make that effort and he follows those commands and is a good, obedient, boy when it comes to food, or cars, or toys, or furniture etc - then I can assure you he will be a good boy in the bedroom too.
Also, don't mistake an obedient dog for a submissive one. Obedience is just about him knowing when he has to put a lid on his innate doggy enthusiasm and instincts. Once he gets the command that he's allowed to indulge them, don't worry - he'll be as delighted and eager to follow his urges as an untrained dog. More so maybe. Trust me.