In his preface to the second edition of The Lord of the Rings, Tolkien writes:
I cordially dislike allegory in all its manifestations, and have always done so since I grew old and wary enough to detect its presence... I think that many confuse "applicability" with "allegory", but one resides in the freedom of the readers, and the other in the purposed domination of the author.
Particularly after the publication of The Lord of the Rings in the 1950s, many people have assumed that the races of Middle-earth must directly stand for real-life peoples: for example, that the goblins (later, the orcs) represent the German Nazis and so on. However, Tolkien himself has strongly resisted any kind of direct connection between the different races we find in his novels – goblins, dwarves, and so on – and the real nations of the Earth. That said, we still might find a morally problematic message in the fact that all of the races in the world of The Hobbit must behave exactly as they're programmed to do. In other words, it's tough to find a really bad elf. Once an elf becomes bad, it's actually no longer an elf. So where is the free will in Tolkien's universe? Is there any indication that it's possible to overcome genetics in this book?