title: Unknown column 'categories1_.category' in 'field list'
body: <p>I have the following model.</p>
  
  <p>Employee.Java</p>
  
  <pre><code>@Entity
  public class Employee {
  
      @Id
      @GeneratedValue(strategy=GenerationType.AUTO)
      private int id;
  
      @Column(name="firstName")
      private String firstName;
  
      @Column(name="lastName")
      private String lastName;
  
      @Column(name = "category")
      @Enumerated(EnumType.STRING)
      @ElementCollection(fetch = FetchType.LAZY)
      @CollectionTable(name = "myobject_categories", joinColumns = @JoinColumn(name = "myobject_id"))
      private Set&lt;Category&gt; categories;
  }
  </code></pre>
  
  <p>Category is an Enum as follows.</p>
  
  <pre><code>public enum Category {
  CATEGORY(1), CATEGORY2(2);
  
  private final Integer id;
  Category(Integer id) { this.id=id; }
  public Integer getId() { return id; }
  }
  </code></pre>
  
  <p>My Repository is as follows,</p>
  
  <pre><code>public interface EmployeeRepository extends CrudRepository&lt;Employee, Integer&gt; {
      @Query("from org.arunm.Employee c WHERE :category MEMBER OF c.categories")
      List&lt;Employee&gt; findAll(@Param("category") Set&lt;Category&gt; categories);
  }
  </code></pre>
  
  <p>The following code to retrieve the list of employees is not working.</p>
  
  <pre><code>Set&lt;Category&gt; categories = new HashSet&lt;Category&gt;();
  categories.add(Category.CATEGORY);
  List&lt;Employee&gt; list = customerRepository.findAll(categories);
  customer.setCategories(categories);
  customerRepository.findAll(categories);
  </code></pre>
  
  <p>In the logs I am seeing the query generated as </p>
  
  <pre><code>select employee0_.id as id1_1_, employee0_.first_name as first_na2_1_, employee0_.last_name as last_nam3_1_ from employee employee0_ where ? in 
  (select categories1_.category from myobject_categories categories1_ where employee0_.id=categories1_.myobject_id)
  </code></pre>
  
  <p>Following is the error that I am getting,</p>
  
  <pre><code>Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'categories1_.category' in 'field list'
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 
  </code></pre>
  
  <p>My question is what is it in my mapping that is forcing hibernate to think that there is a column called <strong>category</strong> in <strong>myobject_categories</strong> table.</p>