Typically it takes 3 days to break a habit, so this may not be weeks of torture for you. It kind of depends on how long he has been doing this - 6 years? Nothing wrong with letting him know you aren't happy with this behavior of whining. You can ignore it and see if that works. But a firm and sharp 'quiet' can work wonders too. Sometimes using a crate can be handy - most dogs will just settle down and relax in the crate until they are let out. But you need to find out if he is crate trained. Also, sometimes sleeping on your bed can help. He will sleep more soundly and deeply next to a warm body. Just some thoughts - one might help.
Love Them & Lead Them,
~Elizabeth & Doug
Dog Training the Way Nature Intended