2 Replies Latest reply on Oct 3, 2009 12:48 PM by blabno

    Two entityhome instance on a form

    James Cheam Newbie

      -- Removed --



        • 1. Re: Two entityhome instance on a form
          blabno Master

          You can have two Seam components (thus two entity homes in your case) by using @Role annotation.
          Better solution I think is to have different DB structure :


          • id

          • code

          • (@OneToMany @JoinTable(name="MENU_LABELS")) List<Label> labels


          • labelId

          • languageCode

          • value

          With this, you need only one entity home.

          • 2. Re: Two entityhome instance on a form
            blabno Master

            There are several options.

            1. In Menu entity constructor you can populate labels attribute :

            public Menu() {
                labels = new ArrayList<Label>(2);
                labels.add(new Label("en"));
                labels.add(new Label("cn"));

            2. Better solution in my opinion is to call custom method on MenuHome just before you start creating Menu, i.e. I do this from s:link :

            public void startCreateProcess() {
                getInstance().labels = new ArrayList<Label>(2);
                instance.labels.add(new Label("en"));
                instance.labels.add(new Label("cn"));

            <s:link value="Create" view="/menu.xhtml" action="#{menuHome.startCreateProcess}"/>