title: org.hibernate.QueryException: could not resolve property
body: <p>This is the first time that I use JPA. I write the code with Java and JPA. My code is below.</p>
  
  <pre><code> String queryStr = "SELECT m.title, b.isbn, b.authors";
      queryStr += " FROM Book b, Media m";
      queryStr += " WHERE m.MediaID = b.MediaID";
              queryStr += " AND b.isbn = '" + isbn + "' AND m.title = '%" + title +"%'"; 
  Query query = em.createQuery(queryStr);
  </code></pre>
  
  <p>From my code, Class Book extends class Media.</p>
  
  <p>But I got the error which is </p>
  
  <blockquote>
    <p>org.hibernate.QueryException: could not resolve property: MediaID of: mediaManagement.Media [SELECT m.title, b.isbn, b.authors FROM mediaManagement.Book b, mediaManagement.Media m WHERE m.MediaID = b.MediaID ]</p>
  </blockquote>
  
  <p>This is the Media class.</p>
  
  <pre><code>@Entity
  @Inheritance(strategy = InheritanceType.JOINED)
  @Table(name = "Media")
  @NamedQuery(name = "findAllMedias", query = "select b from Media b")
  public class Media {
  
  @Id
  @Column(name = "MediaID")
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  private int mediaID;
  
  /**
   * Getter of the property &lt;tt&gt;mediaID&lt;/tt&gt;
   * 
   * @return Returns the mediaID.
   * @uml.property name="mediaID"
   */
  public int getMediaID() {
      return mediaID;
  }
  
  /**
   * Setter of the property &lt;tt&gt;mediaID&lt;/tt&gt;
   * 
   * @param mediaID
   *            The mediaID to set.
   * @uml.property name="mediaID"
   */
  public void setMediaID(int mediaID) {
      this.mediaID = mediaID;
  }
  
  /**
   * @uml.property name="title"
   */
  @Column(name = "title")
  private String title;
  
  /**
   * Getter of the property &lt;tt&gt;title&lt;/tt&gt;
   * 
   * @return Returns the title.
   * @uml.property name="title"
   */
  public String getTitle() {
      return title;
  }
  
  /**
   * Setter of the property &lt;tt&gt;title&lt;/tt&gt;
   * 
   * @param title
   *            The title to set.
   * @uml.property name="title"
   */
  public void setTitle(String title) {
      this.title = title;
  }
  
  /**
   * @uml.property name="editionDate"
   */
  
  private Calendar editionDate;
  
  /**
   * Getter of the property &lt;tt&gt;editionDate&lt;/tt&gt;
   * 
   * @return Returns the editionDate.
   * @uml.property name="editionDate"
   */
  public Calendar getEditionDate() {
      return editionDate;
  }
  
  /**
   * Setter of the property &lt;tt&gt;editionDate&lt;/tt&gt;
   * 
   * @param editionDate
   *            The editionDate to set.
   * @uml.property name="editionDate"
   */
  public void setEditionDate(Calendar editionDate) {
      this.editionDate = editionDate;
  }
  
  /*
   * Two medias are equal if their mediaID is the same
   */
  @Override
  public boolean equals(Object media) {
      if (media == null)
          return false;
      Media b = (Media) media;
  
      if (b.mediaID == mediaID)
          return true;
  
      return false;
  }
  
  public Media() {
  };
  
  /**
   * Creates a media All parameters should be given
   * 
   * @param title
   *            the title of the media
   * 
   * @param editionDate
   *            date of the edition of the media
   * 
   * @throws BadParametersException
   */
  public Media(String title, Calendar editionDate)
          throws BadParametersException {
      if ((title == null) || (editionDate == null))
          throw new BadParametersException();
  
      this.title = title;
      this.editionDate = editionDate;
  
  }
  
  /**
   * Returns a description of the media
   */
  public String toString() {
      return this.title + "  " + String.valueOf(this.title);
  }
  
  /** 
   * @uml.property name="copies"
   * @uml.associationEnd multiplicity="(0 -1)" inverse="media:copyManagement.Copy"
   */
  @OneToMany(mappedBy="mediaRef") protected Set&lt;Copy&gt; copies;
  
  public void addCopy(Copy copy) {
      copies.add(copy);
  }
  
  /** 
   * Getter of the property &lt;tt&gt;copies&lt;/tt&gt;
   * @return Returns the copies.
   * @uml.property name="copies"
   */
  public Set&lt;Copy&gt; getCopies() {
      return copies;
  }
  
  /** 
   * Setter of the property &lt;tt&gt;copies&lt;/tt&gt;
   * @param editionDate The copies to set.
   * @uml.property  name="copies"
   */
  public void setCopies(Set&lt;Copy&gt; copies) {
      this.copies = copies;
  }
  </code></pre>
  
  <p>And this is Book class.</p>
  
  <pre><code>@Entity
  @Table(name = "Book")
  @NamedQuery(name = "findAllBooks", query = "select b from Book b")
  public class Book extends Media {
  /**
   * @uml.property name="authors"
   */
  @Column(name = "authors")
  private ArrayList&lt;String&gt; authors;
  
  /**
   * Getter of the property &lt;tt&gt;authors&lt;/tt&gt;
   * 
   * @return Returns the authors.
   * @uml.property name="authors"
   */
  public ArrayList&lt;String&gt; getAuthors() {
      return authors;
  }
  
  /**
   * Setter of the property &lt;tt&gt;authors&lt;/tt&gt;
   * 
   * @param authors
   *            The authors to set.
   * @uml.property name="authors"
   */
  public void setAuthors(ArrayList&lt;String&gt; authors) {
      this.authors = authors;
  }
  
  /**
   * @uml.property name="isbn"
   */
  
  @Column(name = "isbn")
  private String isbn;
  
  /**
   * Getter of the property &lt;tt&gt;isbn&lt;/tt&gt;
   * 
   * @return Returns the isbn.
   * @uml.property name="isbn"
   */
  public String getisbn() {
      return isbn;
  }
  
  /**
   * Setter of the property &lt;tt&gt;isbn&lt;/tt&gt;
   * 
   * @param isbn
   *            The isbn to set.
   * @uml.property name="isbn"
   */
  public void setisbn(String isbn) {
      this.isbn = isbn;
  }
  
  public Book() {
      // TODO Auto-generated constructor stub
  }
  
  public Book(String title, Calendar editionDate, ArrayList&lt;String&gt; authors,
          String isbn) throws BadParametersException {
      super(title, editionDate);
      this.authors = authors;
      this.isbn = isbn;
      // TODO Auto-generated constructor stub
  }
  
  }
  </code></pre>
  
  <p>Anyone can help?</p>