title: Creating missing subclass entity when super exists
body: <p>I have 2 tables <strong>S</strong> and <strong>I</strong> on the database (with a 1:1 relationship), they both have the same id as pk and the hibernate classes I've created are like these:</p>
  
  <pre><code>@Entity
  @Inheritance(strategy = InheritanceType.JOINED)
  public class S {
     @Id
     @Column(name = "id")
     @GeneratedValue(...)
     @SequenceGenerator...
     private long id;
  
     ....
  }
  
  @Entity
  @PrimaryKeyJoinColumn(name = "id")
  public class I extends S {
      ....
  }
  </code></pre>
  
  <p>Because of historical reasons, in the database there are objects of type <strong>S</strong> but not the associated objects of type <strong>I</strong>. I want to create those <strong>I</strong> type objects using hibernate. How can I do that? Can I create an <strong>I</strong> type object  from an left join HQL query like this?</p>
  
  <pre><code>select i from I i right join i.id s where s.id = :id
  </code></pre>
  
  <p>If I try to create a new <strong>I</strong> entity (new I()) and then persist it, I only managed to get some exceptions as it tries to create an already existing <strong>S</strong> record. I can't do a simple read/load for <strong>I</strong> entity as <strong>I</strong> record does not exist yet. How can I do to create this missing <strong>I</strong> part entity?</p>
  
  <p><em>PS I will adjust the question if you point me the unclear things</em></p>