1 Reply Latest reply on Apr 16, 2008 4:55 AM by rlperry

    How to manage two instances in Home component?

    ovistanciu

      Hello.


      I have a problem. Let's say I have 2 Entities : Child and Parent. Every child has 2 parents, that is in Child there are 2 fields:



      @Entity
      public class Child{
      
             private Parent mom;
             private Parent dad;
      }




      And Parent has a gender:


      @Entity
      public class Parent{
            private int gender; //1 or 2
      }




      Also, I have a ChildHome and a ParentHome. My question: on the ChildEdit (ChildHome component) page, how do I select 2 different(one of each gender) instances of Parent for the Child?
      Do I need to have 2 instances of ParentHome in ChildHome?


      Thank you for your time.

        • 1. Re: How to manage two instances in Home component?
          rlperry

          I think you wanna read section 3.2.9 in the seam reference.  If I follow you correctly you are wanting to annotate Parent with the roles of mom and dad. Though I have not used that with entities specifically, I have just used this in the context of session beans.


          e.g.


          @Roles(
             {@Role(name="mom", scope=SESSION), 
              @Role(name="dad", scope=SESSION)})