0 Replies Latest reply on Oct 1, 2005 8:53 PM by Sven Linstaedt

    Transitive embedded attributes ?

    Sven Linstaedt Newbie

      Is it possible to use embedded attributes, which map to Objects that use for themselves embedded attributes?

      e.g.

      public class Konto implements Serializable {
      
       @Embedded
       @AttributeOverride(name = "betrag", column = @Column(name = "saldo"))
       private Saldo saldo;
      }
      


      @Embeddable(access = AccessType.FIELD)
      public class Saldo implements Serializable {
      
       @Embedded
       @AttributeOverride(name = "value", column = @Column)
       private Betrag _value;
      }
      


      @Embeddable(access = AccessType.FIELD)
      public class Betrag implements Serializable {
      
       private long value;
      }
      


      My problem is the second @AttributeOverride definition. Because i have already mapped the attribute to a column in the first annotation, to what should i map the second one?

      Please just dont ask me, why i do not simply use the primitive long value in the class "Konto". My tutors want me to wrap all primitives in business objects, which might have aditional functionality ;)