title: Error: AnnotationException: mappedBy reference an unknown target entity property
body: <p>I'm creating Spring Boot Application with JPA PostgreSQL.</p>
  
  <p>When I compile my spring project, got the following error.</p>
  
  <blockquote>
    <p>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: eveserver.core.entity.User.name in eveserver.core.entity.Role.users</p>
  </blockquote>
  
  <p>Please, help me to understand what i'm doing wrong.</p>
  
  <p>This is my <strong>User.java</strong></p>
  
  <pre><code>package eveserver.core.entity;
  
  import com.fasterxml.jackson.annotation.JsonIgnore;
  
  import javax.persistence.*;
  import java.io.Serializable;
  import java.util.Set;
  
  @Entity
  @Table(name = "users")
  public class User implements Serializable {
      @Id
      @GeneratedValue
      private Long id;
      @Column(name = "name")
      private String username;
      @JsonIgnore
      @Column(name = "password")
      private String password;
      @Column(name = "email")
      private String email;
      private boolean enabled = false;
  
  
      @ManyToMany
      @JoinTable(name = "user_role",
              joinColumns = @JoinColumn(name = "user_id", referencedColumnName = "id"),
              inverseJoinColumns = @JoinColumn(name = "role_id", referencedColumnName = "id"))
      private Set&lt;Role&gt; roles;
  
      public User(){ }
  
      public User(String username, String password, String email) {
          this.username = username;
          this.password = password;
          this.email = email;
      }
  
      public User(String username, String password, String email, Set&lt;Role&gt; roles) {
          this.username = username;
          this.password = password;
          this.email = email;
          this.roles = roles;
      }
  
      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 getPassword() {
          return password;
      }
  
      public void setPassword(String password) {
          this.password = password;
      }
  
      public String getEmail() {
          return email;
      }
  
      public void setEmail(String email) {
          this.email = email;
      }
  
  
      public Set&lt;Role&gt; getRoles() {
          return roles;
      }
  
      public void setRoles(Set&lt;Role&gt; roles) {
          this.roles = roles;
      }
  
      public void enable(){
          enabled = true;
      }
      public void disable(){
          enabled = false;
      }
  
  }
  </code></pre>
  
  <p><strong>Role.java</strong></p>
  
  <pre><code>package eveserver.core.entity;
  
  import com.fasterxml.jackson.annotation.JsonIgnore;
  import org.springframework.security.core.GrantedAuthority;
  
  import javax.persistence.*;
  import java.util.Set;
  
  @Entity
  @Table(name = "role")
  public class Role  implements GrantedAuthority {
      @Id
      @GeneratedValue
      private Long id;
      private String name;
  
      @ManyToMany(mappedBy = "role")
      @JsonIgnore
      private Set&lt;User&gt; users;
  
      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;
      }
  
      @Override
      public boolean equals(Object obj){
          if (obj instanceof Role){
              Role r = (Role)obj;
              if (r.getId()==this.getId()){
                  return true;
              }
          }
          return false;
      }
  
      public Set&lt;User&gt; getUsers() {
          return users;
      }
  
      public void setUsers(Set&lt;User&gt; users) {
          this.users = users;
      }
  
      @Override
      public String getAuthority() {
          return getName();
      }
  }
  </code></pre>
  
  <p>and this is my <strong>tables</strong></p>
  
  <p><a href="https://i.stack.imgur.com/QTH7x.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QTH7x.png" alt="enter image description here"></a></p>