title: JPA - Only primary key is retrieved, other fields returned null
body: <p>I am new to Java EE.<br />
  I am using Eclipse Juno + Eclipse Link + MySQL.<br />
  Currently I have a JPA project and a dynamic web project.<br />
  The JPA project is included in the web project's build path.<br />
  I created a class "StudentDomain" in JPA project to retrieve rows from Student table.<br />
  It works <b>fine</b> in the JPA project.<br />
  But in web project, only ID is returned, other fields, name, gender, and email all returned null.</p>
  
  <p>For example:<br />
  SQL: SELECT * FROM Student;</p>
  
  <p>In JPA Project, I got the following results:</p>
  
  <pre><code>ID Name   Gender Email
  1  John   M      john@example.com
  2  Emma   F      emma@example.com
  </code></pre>
  
  <p>In Web Project, I got the following results:</p>
  
  <pre><code>ID Name   Gender Email
  1  null   null   null
  2  null   null   null
  </code></pre>
  
  <p>Below is the source code of Student entity class.</p>
  
  <pre><code>package model;
  
  import java.io.Serializable;
  import java.lang.String;
  import javax.persistence.*;
  
  @Entity
  public class Student implements Serializable
  {
      @Id
      @Column(name = "ID")
      private int id;
  
      @Column(name = "name")
      private String name;
  
      @Column(name = "gender")
      private String gender;
  
      @Column(name = "email")
      private String email;
  
      private static final long serialVersionUID = 1L;
  
      public Student()
      {
      }
  
      public int getId()
      {
          return this.id;
      }
  
      public void setId(int id)
      {
          this.id = id;
      }
  
      public String getName()
      {
          return this.name;
      }
  
      public void setName(String name)
      {
          this.name = name;
      }
  
      public String getGender()
      {
          return this.gender;
      }
  
      public void setGender(String gender)
      {
          this.gender = gender;
      }
  
      public String getEmail()
      {
          return this.email;
      }
  
      public void setEmail(String email)
      {
          this.email = email;
      }
  
  }
  </code></pre>