title: How can i map multiple classes to one table in hibernate?
body: <p>From my research it seems not likely that its possible, but here is my use case.</p>
  
  <p>I have a table called user with an address id.</p>
  
  <p>I'd like to map a UserReference and User class to this table where UserReference does not contain the Address object (to save sql joining time) and User <em>does</em> contain the Address object (in case it's needed).</p>
  
  <p>I can't use  since it expects a join table, and I can't just define two separate classes because a get() seems to return double of every row (one for User, one for UserReference).</p>
  
  <p>Does anyone know how I could go about this?</p>
  
  <hr>
  
  <p>I guess I should try to explain myself better.</p>
  
  <pre><code>public class UserReference {
      private int id;
      private String name;
  }
  
  public class User extends UserReference {
      private Address;
  }
  </code></pre>
  
  <p>I'd like to map both UserReference and User so that I can query for UserReference when I only need the basic details, and User whenever I need the full object.</p>
  
  <p>I understand that I can simply have Address be lazy loaded but I have a two tier system which unproxies all objects once it passes through the layers.</p>
  
  <hr>
  
  <p>edit:</p>
  
  <p>Perhaps my question was too ambigious but based on the answers it doesn't seem very possible to do what I want. Thanks anyway everyone.</p>