0 Replies Latest reply on Sep 24, 2007 12:28 PM by Amer Ramamni

    references an unknown entity

    Amer Ramamni Newbie

      I am having a problem when I start the JBoss server.
      The server keeps failing because of an unknown entity.

      this is the code, its a bunch of getters and setters thats all. If you can help why is the server failing that would be great. Please I need to solve this issue fast. I have 2 instance variables projectID and projectID1. Please look at the error below
      Many Thanks

      //This is the error
      State: FAILED
       Reason: org.hibernate.AnnotationException: @OneToOne or @ManyToOne on EntityBean.KnowledgeBase.projectID references an unknown entity: java.lang.Integer
      


      THis is the code
      
      
      /**
       * Entity class KnowledgeBase
       *
       * @author amer.ramamni
       */
      @Entity
      @Table(name = "tblKnowledgeBase")
      @NamedQueries( {
       @NamedQuery(name = "KnowledgeBase.findByKnowledgeID", query = "SELECT k FROM KnowledgeBase k WHERE k.knowledgeID = :knowledgeID"),
       @NamedQuery(name = "KnowledgeBase.findByKnowledgeName", query = "SELECT k FROM KnowledgeBase k WHERE k.knowledgeName = :knowledgeName"),
       @NamedQuery(name = "KnowledgeBase.findByKnowledgeCategory", query = "SELECT k FROM KnowledgeBase k WHERE k.knowledgeCategory = :knowledgeCategory"),
       @NamedQuery(name = "KnowledgeBase.findByDeleted", query = "SELECT k FROM KnowledgeBase k WHERE k.deleted = :deleted")
       })
      public class KnowledgeBase implements Serializable {
      
       @Id
       @Column(name = "knowledgeID", nullable = false)
       private Integer knowledgeID;
      
       @Column(name = "knowledgeName", nullable = false)
       private String knowledgeName;
      
       @Column(name = "knowledgeCategory")
       private String knowledgeCategory;
      
       @Column(name = "deleted", nullable = false)
       private int deleted;
      
       @JoinColumn(name = "projectID", referencedColumnName = "projectID")
       @ManyToOne
       private Project projectID;
      
       @JoinColumn(name = "projectID", referencedColumnName = "projectID")
       @ManyToOne
       private Project projectID1;
      
       /** Creates a new instance of KnowledgeBase */
       public KnowledgeBase() {
       }
      
       public KnowledgeBase(Integer knowledgeID) {
       this.knowledgeID = knowledgeID;
       }
      
       public KnowledgeBase(Integer knowledgeID, String knowledgeName, int deleted) {
       this.knowledgeID = knowledgeID;
       this.knowledgeName = knowledgeName;
       this.deleted = deleted;
       }
      
       public Integer getKnowledgeID() {
       return this.knowledgeID;
       }
      
       public void setKnowledgeID(Integer knowledgeID) {
       this.knowledgeID = knowledgeID;
       }
      
       public String getKnowledgeName() {
       return this.knowledgeName;
       }
      
       public void setKnowledgeName(String knowledgeName) {
       this.knowledgeName = knowledgeName;
       }
      
       public String getKnowledgeCategory() {
       return this.knowledgeCategory;
       }
      
       public void setKnowledgeCategory(String knowledgeCategory) {
       this.knowledgeCategory = knowledgeCategory;
       }
      
       public int getDeleted() {
       return this.deleted;
       }
      
       public void setDeleted(int deleted) {
       this.deleted = deleted;
       }
      
       public Project getProjectID() {
       return this.projectID;
       }
      
       public void setProjectID(Project projectID) {
       this.projectID = projectID;
       }
      
       public Project getProjectID1() {
       return this.projectID1;
       }
      
       public void setProjectID1(Project projectID1) {
       this.projectID1 = projectID1;
       }
      
       @Override
       public int hashCode() {
       int hash = 0;
       hash += (this.knowledgeID != null ? this.knowledgeID.hashCode() : 0);
       return hash;
       }
      
       @Override
       public boolean equals(Object object) {
       // TODO: Warning - this method won't work in the case the id fields are not set
       if (!(object instanceof KnowledgeBase)) {
       return false;
       }
       KnowledgeBase other = (KnowledgeBase)object;
       if (this.knowledgeID != other.knowledgeID && (this.knowledgeID == null || !this.knowledgeID.equals(other.knowledgeID))) return false;
       return true;
       }
      
       @Override
       public String toString() {
       return "EntityBean.KnowledgeBase[knowledgeID=" + knowledgeID + "]";
       }
      
      }