title: org.hibernate.MappingException: Could not determine type for: java.util.Set
body: <p>Although this question asked many times and I have already used all the suggestion but still I am getting this error.</p>
  
  <p>The User.java is</p>
  
  <pre><code>@Entity
  @Table(name = "USER")
  public class User implements UserDetails, Serializable {
  
      private static final long serialVersionUID = 2L;
  
      @Id
      @Column(name = "USER_ID")
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private long id;
      @Column(name = "USERNAME")
      private String username;
      @Column(name = "PASSWORD")
      private String password;
      @Column(name = "NAME")
      private String name;
      @Column(name = "EMAIL")
      private String email;
      @Column(name = "LOCKED")
      private boolean locked;
      @OneToMany(cascade=CascadeType.ALL, fetch = FetchType.EAGER)
      @ElementCollection(targetClass=Role.class)
      @Column(name = "ROLE_ID")
      private Set&lt;Role&gt; roles;
  
      @Override
      public GrantedAuthority[] getAuthorities() {
          List&lt;GrantedAuthorityImpl&gt; list = new ArrayList&lt;GrantedAuthorityImpl&gt;(0);
          for (Role role : roles) {
              list.add(new GrantedAuthorityImpl(role.getRole()));
          }
          return (GrantedAuthority[]) list.toArray(new GrantedAuthority[list.size()]);
      }
  
      @Override
      public boolean isAccountNonExpired() {
          return true;
      }
  
      @Override
      public boolean isAccountNonLocked() {
          return !isLocked();
      }
  
      @Override
      public boolean isCredentialsNonExpired() {
          return true;
      }
  
      @Override
      public boolean isEnabled() {
          return true;
      }
  
      public long getId() {
          return id;
      }
  
      public void setId(long id) {
          this.id = id;
      }
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public String getEmail() {
          return email;
      }
  
      public void setEmail(String email) {
          this.email = email;
      }
  
      public boolean isLocked() {
          return locked;
      }
  
      public void setLocked(boolean locked) {
          this.locked = locked;
      }
  
      @Override
      public String getUsername() {
          return username;
      }
  
      public void setUsername(String username) {
          this.username = username;
      }
  
      @Override
      public String getPassword() {
          return password;
      }
  
      public void setPassword(String password) {
          this.password = password;
      }
  
      public void setRoles(Set&lt;Role&gt; roles) {
          this.roles = roles;
      }
  
      public Set&lt;Role&gt; getRoles() {
          return roles;
      }
  }
  </code></pre>
  
  <p>And the Role.java is</p>
  
  <pre><code>@Entity
  @Table(name="ROLE")
  public class Role implements Serializable {
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      @Column(name="ROLE_ID")
      private long id;
      @Column(name="USERNAME")
      private String username;
      @Column(name="ROLE")
      private String role;
  
  
      public long getId() {
          return id;
      }
  
      public void setId(long id) {
          this.id = id;
      }
  
      public String getUsername() {
          return username;
      }
  
      public void setUsername(String username) {
          this.username = username;
      }
  
      public String getRole() {
          return role;
      }
  
      public void setRole(String role) {
          this.role = role;
      }
  }
  </code></pre>
  
  <p>This is my first attempt in hibernate annotation with JPA. So any suggestions will be very helpful. </p>
  
  <p>For hibernate the pom.xml's dependencies are:</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate&lt;/artifactId&gt;
          &lt;version&gt;3.5.4-Final&lt;/version&gt;
          &lt;type&gt;pom&lt;/type&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-annotations&lt;/artifactId&gt;
          &lt;version&gt;3.5.4-Final&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
          &lt;version&gt;3.5.4-Final&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
          &lt;version&gt;3.1.0.GA&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
          &lt;version&gt;3.5.4-Final&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>I have no clue about the fault.</p>
  
  <p>Thanks.</p>