0 Replies Latest reply on Jan 21, 2007 6:31 PM by Christian Stalp

    Improper relationship betrween Entity-Beans

    Christian Stalp Newbie

      Hello out there,
      I created for my small project two Entity-Beans which have a 1toN-relationship. In detail I have one ZugangsdatenBean (this is german but it doesn't matter what this means) and several TanBeans. From my point of view, there should be no problems. I show you the two beans. First the ZugangsdatenBean which is on the '1'-Edge:

      @Entity
      @Table(name="ZUGANGSDATEN")
      public class ZugangsdatenBean implements Serializable
      {
       private static final long serialVersionUID = 1L;
       private String passwort;
       private String login_Name;
       private String pin;
       private Collection <TanBean> tans = new ArrayList<TanBean>();
      
       public ZugangsdatenBean() {}
      
       public ZugangsdatenBean( String passwort, String login_name, String pin )
       {
       this.passwort = passwort;
       this.login_Name = login_name;
       this.pin = pin;
       }
      
       @Column (name="PASSWORT")
       public String getpassword()
       {
       return this.passwort;
       }
      
       public void setpassword(String mypassword)
       {
       this.passwort = mypassword;
       }
      
       @Column (name="LOGIN")
       public String getlogin_name()
       {
       return this.login_Name;
       }
      
       public void setlogin_name(String mylogin)
       {
       this.login_Name = mylogin;
       }
      
       @Id
       @Column (name="PIN")
       public String getpin()
       {
       return this.pin;
       }
      
       public void setpin(String mypin)
       {
       this.pin = mypin;
       }
      
      
       @OneToMany (mappedBy="zugangsdatenbean",cascade=CascadeType.ALL, fetch=FetchType.EAGER)
       public Collection <TanBean> getAllTans()
       {
       return this.tans;
       }
      
       public void setTans(Collection <TanBean> mytan)
       {
       this.tans = mytan;
       }
      
      
      }
      
      And now the TanBean:
      @Entity
      @Table(name="TAN")
      public class TanBean implements Serializable
      {
       private static final long serialVersionUID = 1L;
       private String nummer;
       private ZugangsdatenBean zugang = null;
      
       public TanBean (String mynummer)
       {
       this.nummer = mynummer;
       }
      
       @Id
       @Column (name="TNUMMER")
       @GeneratedValue ()
       public String getNummer()
       {
       return this.nummer;
       }
      
       public void setNummer(String mynummer)
       {
       this.nummer = mynummer;
       }
      
       @ManyToOne
       @JoinColumn(name="ZUGANGSDATEN")
       public ZugangsdatenBean getZugangsDaten()
       {
       return this.zugang;
       }
      
       public void setZugangsDaten(ZugangsdatenBean myzugang)
       {
       this.zugang = myzugang;
       }
      }
      

      The Eclipse-Console give me this errors:
      23:52:14,124 WARN [ServiceController] Problem starting service persistence.units:ear=TestBank.ear,jar=TestBankEJB.jar,unitName=chaos
      org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: org.chaos.tans.TanBean.zugangsdatenbean in org.chaos.zugangsdaten.ZugangsdatenBean.allTans


      What is my misstake?

      Than you

      Gruss Christian