1 Reply Latest reply on Sep 8, 2005 12:08 PM by epbernard

    Entity inside Embeddable with AttributeOverride

    michael_c_small

      I have the following object model:

      @Entity
      public class State {
      
       private Long id;
       private String abbreviation;
       private String fullName;
      
       public String getAbbreviation() { ... }
       public void setAbbreviation(String abbreviation) { ... }
      
       public String getFullName() { ... }
       public void setFullName(String fullName) { ... }
      
      }
      
      @Embeddable
      public class Address {
      
       private String address1;
       private String address2;
       private String city;
       private State state;
       private String zipcode;
      
       public String getAddress1() { ... }
       public void setAddress1(String address1) { ... }
      
       public String getAddress2() { ... }
       public void setAddress2(String address2) { ... }
      
       public String getCity() { ... }
       public void setCity(String city) { ... }
      
       @ManyToOne
       @JoinColumn(name="fk_state")
       public State getState() { ... }
       public void setState(State state) { ... }
      
       public String getZipcode() { ... }
       public void setZipcode(String zipcode) { ... }
      
      }
      


      My first question would be whether an Entity object can be used in Embedded objects as described above. My second question would be how to handle the attribute override of the State Entity.