title: How to properly map nested subclasses using hibernate
body: <p>How do I nest subclasses with Hibernate?</p>
  
  <p>For example, I have the following class hierarchy:</p>
  
  <pre><code>PageElement
  - PageParagraph
  - PageImage
  - PageVideo
  - PageAudio
  - PageQuestion
    - PageFillInTheBlankQuestion
    - PageOpenEndedQuestion
    - PageMultipleChoiceQuestion
    - ...
  </code></pre>
  
  <p>This is the ideal object structure. How can I successfully map this using Hibernate? I would say that the <code>PageQuestion</code> abstract class is VERY important. It contains a lot of reusable properties and logic. I also need to reference <code>PageQuestion</code> specifically while not referencing <code>PageElement</code> &lt;- this would be bad. I'd also like to query against all <code>PageQuestion</code> objects.</p>