0 Replies Latest reply on Apr 19, 2011 6:27 AM by vata2999

    Seam gen parent child bug

    vata2999

      Hi,


      I have two tables : eb_parent and eb_child


      eb_child has two foreign key references to eb_parent


      CREATE TABLE eb_child
      (
        id bigint NOT NULL,
        pidaction bigint,
        pidromance bigint,
        CONSTRAINT eb_child_pkey PRIMARY KEY (id),
        CONSTRAINT eb_child_pidaction_fkey FOREIGN KEY (pidaction)
            REFERENCES eb_parent (id) MATCH SIMPLE
            ON UPDATE NO ACTION ON DELETE NO ACTION,
        CONSTRAINT eb_child_pidromance_fkey FOREIGN KEY (pidromance)
            REFERENCES eb_parent (id) MATCH SIMPLE
            ON UPDATE NO ACTION ON DELETE NO ACTION
      )



      after i run seam generate i get this code in wire metheod



      getInstance();
                      EbParent ebParentByGidaction = ebParentHome.getDefinedInstance();
                      if (ebParentByGidaction != null) {
                              getInstance().setEbParentByGidaction(ebParentByGidaction);
                      }
                      EbParent ebParentByGidromance = ebParentHome.getDefinedInstance();
                      if (ebGameByGidromance != null) {
                              getInstance().setEbParentByGidromance(ebParentByGidromance);
                      }


      this code sets same instance from selected parent into two different child columns


      what is the best way to solve this problem ?


      PS : also there is another bug generate same id for two different button


      <s:button id="#{ebChildHome.instance.ebGameByGidromance != null ? 'changeParent' : 'selectParent'}" value="#{ebChildHome.instance.ebGameByGidromance != null ? 'Change' : 'Select'} ebGameByGidromance"
                             view="/EbGameList.xhtml">
                      <f:param name="from" value="EbChildEdit"/>
                  </s:button>