title: Reverse inheritance mapping in Hibernate
body: <p>I have a three tables:</p>
  
  <p><strong>Domain</strong></p>
  
  <pre><code>|Field   |Type         |
  | id     | BIGINT      |
  | domain | VARVHAR(45) |
  | other  | ...         |
  </code></pre>
  
  <p><strong>Url</strong></p>
  
  <pre><code>|Field      |Type         |
  | id        | BIGINT      |
  | domain_id | BIGINT      |
  | url       | VARCHAR(45) |
  | other     | ...         |
  </code></pre>
  
  <p><strong>Data</strong></p>
  
  <pre><code>|Field      |Type                  |
  | id        | BIGINT               |
  | type      | ENUM('DOMAIN','URL') |
  | entity_id | BIGINT               |
  | data      | ...                  |
  </code></pre>
  
  <p>Under <em>other</em> fields, witch contains in <strong>Domain</strong> and <strong>Url</strong> tables I understand the some fields, whitch different between themselves by types.</p>
  
  <p>Field <em>entity_id</em> in the <strong>Data</strong> table must contain the ID from the table <strong>Domain</strong> or <strong>Url</strong> depending on value of <em>type</em> fields in the <strong>Data</strong> table.</p>
  
  <p>How I can create this xml mapping for Hibernate use?</p>