title: Can we extends @Entity class from @Embedded class
body: <pre><code>@Embeddable
  @MappedSuperclass
  public class Address {
    private String street;
    private String city;
  
  public String getStreet(){ return street;}
  public String getCity(){ return city;}
  public String setStreet(Sting street){ this.street= street;}
  public String setCity(String city){ this.city=city;}
  
  }
  
  import org.hibernate.annotations.Entity;
  @Entity
  public class AddressHistory extends Address {
   Long id;
   @Id @XmlTransient
   @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
      return m_id;
    }
  
   public void setId(Long m_id) {
      this.m_id = m_id;
   }
  }
  </code></pre>
  
  <p>Here is my scenario, I want to store address of a person. And I also have to store all the address that a person has live before. So what I am doing is I am embedding current address in person table and would like to store all his/her pervious address in history table. To achieve this. I made Address class embeddable and embedded it into person table and HistoryAddress table. But as of OOPS concept. HistoryAddress is a Address, so it is not good to do composition of Address class into AddressHistory. Then I decided to extends AddressHistory from Address class. BUt when I do this hibernate gives me this error </p>
  
  <pre><code>Use of @OneToMany or @ManyToMany targeting an unmapped class AddressHistory.
  </code></pre>
  
  <p>But clearly I have mapped AddressHistory
  Can we do this ? Can we extend Entity from Embedded class ?</p>