4 Replies Latest reply on Feb 15, 2008 5:03 PM by degzhaus

    seam-gen:s generate-ui

      If you have a onetomany relation, generate-ui will create a tab-panel with a children list when viewing an entity.


      Where, if possible, are one supposed to add children? Or is just not included (yet...)? I would really like if there was a nice shuttle list where one could add children. :-)


      There is an 'Add <child entity name>' button which only takes you to the edit entity view.


        • 1. Re: seam-gen:s generate-ui
          degzhaus

          The view that looks like the edit entity view is actually a selection view.  Simply click

          Select

          on your desired row and it will navigate back to the parent view with the chosen child selected.


          You'll notice the url is still ParentEdit.seam, not ChildEdit.seam.

          • 2. Re: seam-gen:s generate-ui

            Well, that's the problem: I don't have any rows to select, the only thing I can change is the primitive attributes.


            I can't see if it's the ParentEdit or ChildEdit url, since this is a reference to the same entity. (Like a 'Person' entity having 'Person' children and a 'Person' parent). Is that the problem?

            • 3. Re: seam-gen:s generate-ui

              I investigated this a little more thurough.


              1) Using a ChildEntity with foreign key to a ParentEntity:


              a) I can choose a ChildEntity, edit, choose ParentEntity from a list and save. Works like I'd expected. (Missing 'remove parent' or 'set parent to null' though).


              b) If I choose to edit a ParentEntity there is a list of children and a button 'Add childEntity'. This button takes me to the 'create ChildEntity view'. If I create a new child and save, I return to the edit ParentEntity view. Saving here saves the ParentEntity with the newly created ChildEntity. In other words: I can create a new child and add it to a parent, but I cant add an already existing child. Is this expected? Or should one use 1a for this?


              2) Using an MyEntity with foreign key to itself:


              a) I can't even chose a parent MyEntity. If I (manually) set a parent, it will show up in the parent tab.


              b) If I do like in 1b), the same thing will happen but when I chose 'add child' I will come to an 'edit parent' page, and not 'add a new child' page. I think having parents/children of the same entity breaks the ui in some way.

              • 4. Re: seam-gen:s generate-ui
                degzhaus

                I had a similar problem Here.  For some of these more complex relationship models you really have to coach the seam-gen generated code.  I didn't have a foreign key to the same table, but the symptoms you're describing are eerily similar.  I would try copying your PersonHome object into ParentHome and ChildHome (you could leave one as is in determining if this will indeed help solve your problem).


                Do keep me posted!