title: 'Basic' attribute type should not be a container;For both properties-based access both setter and getter should be present
body: <p>I'm new to Spring boot. 
  I try to implement the login and registration function using Spring Security and Hibernate. </p>
  
  <p>First, I use Hibernate to generate the persistence mapping Entity Class from the database. And I need to implement UserDetails interface in the UserEntity class, but the problem happened.</p>
  
  <p>I can't implement the methods in UserDetails.</p>
  
  <p>Error occurs when I try to implement getAuthorities.
  Here is the error information.</p>
  
  <p>'Basic' attribute type should not be a container.
  Inspection info: This inspection checks for the following JPA specification errors:</p>
  
  <ul>
  <li>Attribute types checking(collection,entity,embeddable,etc.)</li>
  </ul>
  
  <p>For property-based access both setter and getter should be present
  Inspection info:This inspection checks for the following JPA specification errors:</p>
  
  <ul>
  <li>More than one attribute configured for method/field</li>
  <li>Attribute cannot be used in Embeddable object(JPA 1.0)</li>
  <li>Persistent attribute metadata should be specified on field or property getter</li>
  <li>For property-based access both setter and getter should be present</li>
  </ul>
  
  <p>Here is my code.</p>
  
  <pre><code>package com.example.demo;
  
  import org.springframework.security.core.GrantedAuthority;
  import org.springframework.security.core.authority.SimpleGrantedAuthority;
  import org.springframework.security.core.userdetails.UserDetails;
  
  import javax.persistence.*;
  import java.util.ArrayList;
  import java.util.Collection;
  import java.util.List;
  import java.util.Objects;
  
  @Entity
  @Table(name = "user", schema = "demo", catalog = "")
  public class UserEntity implements UserDetails {
      private String username;
      private String password;
      private String role;
      private String nickname;
      private String phone;
  
      @Override
      public Collection&lt;? extends GrantedAuthority&gt; getAuthorities(){
          String[] authorities=role.split(",");
          List&lt;SimpleGrantedAuthority&gt; authorityList=new ArrayList&lt;&gt;();
          for(String string:authorities)
              authorityList.add(new SimpleGrantedAuthority(string));
          return authorityList;
      }
  
      @Override
      public boolean isAccountNonExpired() {
          return true;
      }
  
      @Override
      public boolean isAccountNonLocked() {
          return true;
      }
  
      @Override
      public boolean isCredentialsNonExpired() {
          return true;
      }
  
      @Override
      public boolean isEnabled() {
          return true;
      }
  
      @Id
      @Column(name = "username", nullable = false, length = 16)
      @Override
      public String getUsername() {
          return username;
      }
  
      public void setUsername(String username) {
          this.username = username;
      }
  
      @Basic
      @Column(name = "password", nullable = true, length = 32)
      @Override
      public String getPassword() {
          return password;
      }
  
      public void setPassword(String password) {
          this.password = password;
      }
  
      @Basic
      @Column(name = "nickname", nullable = true, length = 32)
      public String getNickname() {
          return nickname;
      }
  
      public void setNickname(String nickname) {
          this.nickname = nickname;
      }
  
      @Basic
      @Column(name = "phone", nullable = true, length = 11)
      public String getPhone() {
          return phone;
      }
  
      public void setPhone(String phone) {
          this.phone = phone;
      }
  
      @Override
      public boolean equals(Object o) {
          if (this == o) return true;
          if (o == null || getClass() != o.getClass()) return false;
          UserEntity that = (UserEntity) o;
          return Objects.equals(username, that.username) &amp;&amp;
                  Objects.equals(password, that.password) &amp;&amp;
                  Objects.equals(nickname, that.nickname) &amp;&amp;
                  Objects.equals(phone, that.phone);
      }
  
      @Override
      public int hashCode() {
          return Objects.hash(username, password, nickname, phone);
      }
  }
  </code></pre>
  
  <p>And I have created a totally the same class as the UserEntity, with implementing UserDetails, and the problem disappeared. Maybe that's a little stupid but I've tried many times. I can't solve it. Please help.</p>