1 Reply Latest reply on Nov 10, 2005 4:29 PM by ajwhitney

    Is there an equivalent annotation for composite-element pare

    ajwhitney

      I am migrating an application which currently uses hibernate to EJB3. I am porting the collections (lists) of <composite-element>s to @Embeddeds (which I understand is a hibernate extension to EJB3 persistence). In the existing model, the composite-elements have a back reference to their parent which is populated via the <composite-element>'s element. Is there a similar concept in the annotation world? I can't seem to figure out how to do this.

      A.J. Whitney
      ajwhitney@clearpgress.com

        • 1. Re: Is there an equivalent annotation for composite-element
          ajwhitney

          An example is this collection of street addresses on a contact. The street address is marked as @Embeddable and has an owner property in addition to the regular address-related properties

          @OneToMany(targetEntity = StreetAddress.class, cascade = CascadeType.ALL)
          @IndexColumn(name = "COL_INDEX")
          @JoinTable(
          table = @Table(name="TBL_STREET_ADDRESS"),
          joinColumns = @JoinColumn(name="COL_OWNER")
          )
          private List streetAddresses = new ArrayList();

          How should the owner property on StreetAddress be declared so COL_OWNER is mapped to the owner property? Is there something else that should be done for the collection defined above?