0 Replies Latest reply on Mar 17, 2008 7:11 AM by Sascha Hoffmann

    Column name can not found in JoinColumns.referencedColumnNam

    Sascha Hoffmann Newbie

      Hello all

      I got a EntityBean that includes 3 Tables. This is the first time i use one that includes 3 tables. Also my experience is not good. If i try to deploy the Bean, JBoss throws the following exception:

      10:46:36,984 INFO [EntityBinder] Bind entity ejb.LOV_User_Right on table LOV_USER_RIGHT
      10:46:37,000 INFO [EntityBinder] Adding secondary table to entity ejb.LOV_User_Right -> LOV_RIGHT_RULE
      10:46:37,000 INFO [EntityBinder] Adding secondary table to entity ejb.LOV_User_Right -> LOV_USER
      10:46:37,015 WARN [ServiceController] Problem starting service persistence.units:jar=Test.jar,unitName=tcdb
      org.hibernate.AnnotationException: Column name lov_urt_right_rule_sign of ejb.LOV_User_Right not found in JoinColumns.referencedColumnName
       at org.hibernate.cfg.annotations.TableBinder.bindFk(TableBinder.java:297)
       at org.hibernate.cfg.annotations.EntityBinder.bindJoinToPersistentClass(EntityBinder.java:424)
      ......
      


      My EntityBean looks like this:
      package ejb;
      
      /**
       * Programm: TC-Login-LOV_USER_RIGHT-EntityBean
       *
       * Beschreibung: Login für Thomas Cook. Das Bean bildet die Datenbanktabelle LOV_USER_RIGHT
       * ab und übernimmt die kommuniktaion mit der Datenbank.
       *
       * Autor:
       */
      
      import javax.persistence.*;
      
      @Entity
      @IdClass(LOV_User_RightPK.class)
      @NamedQueries({
       @NamedQuery(name="LOV_User_Right.findByName",
       query="SELECT l FROM LOV_User_Right l " +
       "WHERE l.lov_urt_user = :name " +
       "AND l.lov_urt_status_sign = 'A'")
      })
      @Table(name="LOV_USER_RIGHT")
      @SecondaryTables({
       @SecondaryTable(name="LOV_RIGHT_RULE",
       pkJoinColumns={
       @PrimaryKeyJoinColumn(name="LOV_RR_RIGHT_RULE_SIGN", referencedColumnName="LOV_URT_RIGHT_RULE_SIGN")}),
       @SecondaryTable(name="LOV_USER",
       pkJoinColumns={
       @PrimaryKeyJoinColumn(name="LOV_USR_USER", referencedColumnName="LOV_URT_USER")})
      })
      public class LOV_User_Right implements java.io.Serializable {
      
       private static final long serialVersionUID = 1;
      
       //LOV_USER_RIGHT
       private String lov_urt_user;
       private int lov_urt_right_rule_sign;
       private String lov_urt_status_sign;
       private String lov_urt_new_date;
       private String lov_urt_update_date;
       private String lov_urt_last_user;
      
       //LOV_USER
       //private String lov_usr_user;
       private String lov_usr_user_name;
       private String lov_usr_user_password;
       private int lov_usr_admin_sign;
       private String lov_usr_status_sign;
       private String lov_usr_new_date;
       private String lov_usr_update_date;
       private String lov_usr_last_user;
      
       //LOV_RIGHT_RULE
       //private int lov_rr_right_rule_sign;
       private String lov_rr_right_rule_text;
       private String lov_rr_status_sign;
       private String lov_rr_new_date;
       private String lov_rr_update_date;
       private String lov_rr_last_user;
      
       //LOV_USER_RIGHT
       @Id
       @Column(name="LOV_URT_RIGHT_RULE_SIGN")
       public int getlov_urt_right_rule_sign() {return lov_urt_right_rule_sign;}
       public void setlov_urt_right_rule_sign(int sign) {this.lov_urt_right_rule_sign = sign;}
      
       @Id
       @Column(name="LOV_URT_USER")
       public String getlov_urt_user() {return lov_urt_user;}
       public void setlov_urt_user(String lov_urt_user) {this.lov_urt_user = lov_urt_user;}
      
       @Column(name="LOV_URT_STATUS_SIGN")
       public String getlov_urt_status_sign() {return lov_urt_status_sign;}
       public void setlov_urt_status_sign(String lov_urt_status_sign) {this.lov_urt_status_sign = lov_urt_status_sign;}
      
       @Column(name="LOV_URT_NEW_DATE")
       public String getlov_urt_new_date() {return lov_urt_new_date;}
       public void setlov_urt_new_date(String lov_urt_new_date) {this.lov_urt_new_date = lov_urt_new_date;}
      
       @Column(name="LOV_URT_UPDATE_DATE")
       public String getlov_urt_update_date() {return lov_urt_update_date;}
       public void setlov_urt_update_date(String lov_urt_update_date) {this.lov_urt_update_date = lov_urt_update_date;}
      
       @Column(name="LOV_URT_LAST_USER")
       public String getlov_urt_last_user() {return lov_urt_last_user;}
       public void setlov_urt_last_user(String lov_urt_last_user) {this.lov_urt_last_user = lov_urt_last_user;}
      
       //LOV_USER
       /*@Column(name="LOV_USR_USER", table="LOV_USER")
       public String getlov_usr_user() {return lov_usr_user;}
       public void setlov_usr_user(String benutzer) {this.lov_usr_user = benutzer;}*/
      
       @Column(name="LOV_USR_USER_NAME", table="LOV_USER")
       public String getlov_usr_user_name() {return lov_usr_user_name;}
       public void setlov_usr_user_name(String user_name) {this.lov_usr_user_name = user_name;}
      
       @Column(name="LOV_USR_USER_PASSWORD", table="LOV_USER")
       public String getlov_usr_user_password() {return lov_usr_user_password;}
       public void setlov_usr_user_password(String user_password) {this.lov_usr_user_password = user_password;}
      
       @Column(name="LOV_USR_ADMIN_SIGN", table="LOV_USER")
       public int getlov_usr_admin_sign() {return lov_usr_admin_sign;}
       public void setlov_usr_admin_sign(int admin_sign) {this.lov_usr_admin_sign = admin_sign;}
      
       @Column(name="LOV_USR_STATUS_SIGN", table="LOV_USER")
       public String getlov_usr_status_sign() {return lov_usr_status_sign;}
       public void setlov_usr_status_sign(String status_sign) {this.lov_usr_status_sign = status_sign;}
      
       @Column(name="LOV_USR_NEW_DATE", table="LOV_USER")
       public String getlov_usr_new_date() {return lov_usr_new_date;}
       public void setlov_usr_new_date(String new_date) {this.lov_usr_new_date = new_date;}
      
       @Column(name="LOV_USR_UPDATE_DATE", table="LOV_USER")
       public String getlov_usr_update_date() {return lov_usr_update_date;}
       public void setlov_usr_update_date(String update_date) {this.lov_usr_update_date = update_date;}
      
       @Column(name="LOV_USR_LAST_USER", table="LOV_USER")
       public String getlov_usr_last_user() {return lov_usr_last_user;}
       public void setlov_usr_last_user(String last_user) {this.lov_usr_last_user = last_user;}
      
       //LOV_RIGHT_RULE
       /*@Column(name="LOV_RR_RIGHT_RULE_SIGN", table="LOV_RIGHT_RULE")
       public int getlov_rr_right_rule_sign() {return lov_rr_right_rule_sign;}
       public void setlov_rr_right_rule_sign(int lov_rr_right_rule_sign) {this.lov_rr_right_rule_sign = lov_rr_right_rule_sign;}*/
      
       @Column(name="LOV_RR_RIGHT_RULE_TEXT", table="LOV_RIGHT_RULE")
       public String getlov_rr_right_rule_text() {return lov_rr_right_rule_text;}
       public void setlov_rr_right_rule_text(String right_rule_text) {this.lov_rr_right_rule_text = right_rule_text;}
      
       @Column(name="LOV_RR_STATUS_SIGN", table="LOV_RIGHT_RULE")
       public String getlov_rr_status_sign() {return lov_rr_status_sign;}
       public void setlov_rr_status_sign(String status_sign) {this.lov_rr_status_sign = status_sign;}
      
       @Column(name="LOV_RR_NEW_DATE", table="LOV_RIGHT_RULE")
       public String getlov_rr_new_date() {return lov_rr_new_date;}
       public void setlov_rr_new_date(String new_date) {this.lov_rr_new_date = new_date;}
      
       @Column(name="LOV_RR_UPDATE_DATE", table="LOV_RIGHT_RULE")
       public String getlov_rr_update_date() {return lov_rr_update_date;}
       public void setlov_rr_update_date(String update_date) {this.lov_rr_update_date = update_date;}
      
       @Column(name="LOV_RR_LAST_USER", table="LOV_RIGHT_RULE")
       public String getlov_rr_last_user() {return lov_rr_last_user;}
       public void setlov_rr_last_user(String last_user) {this.lov_rr_last_user = last_user;}
      }
      

      Can somebody tell me where the problem is? All columns in the Bean are in the table too.