1 Reply Latest reply on Mar 25, 2011 8:03 AM by dirkkuyt

    Reflexive association

    dirkkuyt

      Hello everybody

      I've a simple problem on Jboss Seam

      I'm using seam-gen, and this is my classe (POJO)



      @Entity
      public class LigneStock implements Serializable {

          private static final long serialVersionUID = 1L;
       
          @ManyToOne
          @JoinColumn(name = "deplacement_id")
          @NotNull
          public Deplacement deplacement;

          @OneToMany(mappedBy = "lotParent", fetch = FetchType.LAZY)
          public Set<LigneStock> sousLots = new HashSet<LigneStock>();

       
          @ManyToOne
          @JoinColumn(name = "emplacement")
          public Emplacement emplacement;


          @ManyToOne
          @JoinColumn(name = "lotParentParent")
          public LigneStock lotParent;

      getters + setters ...

      }



      The problem is ; when I create an instance of LigneStock, I can't create an instance of 'lotParent' and 'sousLots' (the fields of this class which are the same type)
      Theses two objects have the same EntityHome, I can't add the 'lotParent', I have only the edit page (not add page).
      The problem is clear, I need your help to resolve it please.


      I repeat, I'm using Seam-Gen

      I have no errors, no exceptions

      Thank you very much


      (Jboss 5.1 GA, Seam 2.2, PostGres)




      --
      Regards

      Talibi Sakhr

        • 1. Re: Reflexive association
          dirkkuyt


          
          + *<blockquote>
          _Sakhr Talibi wrote on Mar 25, 2011 08:01:_<br/>
          
          |Hello everybody
           
          I've a simple problem on Jboss Seam
           
          I'm using seam-gen, and this is my classe (POJO)
           
           
           
          @Entity
          public class LigneStock implements Serializable {
           
              private static final long serialVersionUID = 1L;
            
              @ManyToOne
              @JoinColumn(name = "deplacement_id")
              @NotNull
              public Deplacement deplacement;
           
              @OneToMany(mappedBy = "lotParent", fetch = FetchType.LAZY)
              public Set<LigneStock> sousLots = new HashSet<LigneStock>();
           
            
              @ManyToOne
              @JoinColumn(name = "emplacement")
              public Emplacement emplacement;
           
           
              @ManyToOne
              @JoinColumn(name = "lotParentParent")
              public LigneStock lotParent;
           
          getters + setters ...
           
          }
           
           
           
          The problem is ; when I create an instance of LigneStock, I can't create an instance of 'lotParent' and 'sousLots' (the fields of this class which are the same type)
          Theses two objects have the same EntityHome, I can't add the 'lotParent', I have only the edit page (not add page).
          The problem is clear, I need your help to resolve it please.
           
           
          I repeat, I'm using Seam-Gen
           
          I have no errors, no exceptions
           
          Thank you very much
           
           
          (Jboss 5.1 GA, Seam 2.2, PostGres)
           
           
          
          
          -- 
          Regards
          
          Talibi Sakhr|
          </blockquote>
          
          Click HELP for text formatting instructions. Then edit this text and check the preview.*