title: PropertyAccessException: could not get a field value by reflection getter
body: <p>I have a many to one mapping with two classes (code is reduced):</p>
  
  <p>Category:</p>
  
  <pre><code>@Entity
  public class Category {
  
      @Id
      @Column(name = "CATEGORY_ID")
      Long id;
  
      @NotNull
      String name;
  </code></pre>
  
  <p>Subcategory:</p>
  
  <pre><code>@Entity
  public class Subcategory {
  
      @Id
      @Column(name = "SUBCATEGORY_ID")
      Long id;
  
      @NotNull
      @ManyToOne(targetEntity = Category.class)
      @JoinColumn(name = "CATEGORY_ID")
      Long categoryId;
  
      @NotNull
      String name;
  </code></pre>
  
  <p>When I try to add subcategory to existing category, I get</p>
  
  <pre><code>ERROR [org.jboss.ejb3.invocation] JBAS014134: EJB Invocation failed on component SubcategoryController for method public void %package%.SubcategoryController.add(%package%.Subcategory): javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of %package%.Category.id
  ...
      at %package%.SubcategoryController$$$view1.add(Unknown Source)
  ...
      at %package%.SubcategoryController$Proxy$_$$_Weld$Proxy$.add(SubcategoryController$Proxy$_$$_Weld$Proxy$.java)
      at %package%.SubcategoryService.add(SubcategoryService.java:30)
      at %package%.SubcategoryService$Proxy$_$$_WeldClientProxy.add(SubcategoryService$Proxy$_$$_WeldClientProxy.java)
  ...
  Caused by: javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of %package%.Category.id
  </code></pre>
  
  <p>What should I do to awoid this error?</p>