title: MySQL Hibernate Use of @OneToMany or @ManyToMany targeting an unmapped class
body: <p>I'm kinda confused what's wrong here. I'm new at using hiberate.</p>
  
  <p>I want to get a list where I can get an ID and Role at the same time</p>
  
  <p>Here's my pojo</p>
  
  <p><strong>Users.java</strong></p>
  
  <pre><code>import java.io.Serializable;
  import java.util.List;
  import javax.persistence.*;
  @Entity
  @Table(name= "users")
  public class Users implements Serializable{
  
      private static final long serialVersionUID = 1L;
  
      @Id
      @GeneratedValue(strategy =GenerationType.AUTO)
      private Long userId;
      private String firstName;
      private String middleName;
      private String lastName;
      private String password;
      private String emailAddress;
      private String gender;
      private String username;
      private String birthDate;
      private String address;
      private String contactNo;
  
      @OneToMany(fetch = FetchType.EAGER)
      private List&lt;BusinessHandled&gt; businessHandled;
  
  
      public Users(){
  
      }
      public Users(Users user) {
          this.userId = user.userId;
          this.username = user.username;
          this.emailAddress = user.emailAddress;
          this.password = user.password;
          this.gender=user.gender;
          this.firstName=user.firstName;
          this.middleName=user.middleName;
          this.lastName=user.lastName;
          this.birthDate=user.birthDate;
          this.address=user.address;
          this.contactNo=user.contactNo;
          this.businessHandled = user.businessHandled;
  
      }
  
  
  
  
  }
  </code></pre>
  
  <p>here's my 
  <strong>BusinessHandled.java</strong></p>
  
  <pre><code>import javax.persistence.FetchType;
  import javax.persistence.JoinColumn;
  import javax.persistence.ManyToOne;
  
  public class BusinessHandled {
  
      @ManyToOne(fetch = FetchType.EAGER)
      @JoinColumn(name="business_id")
      private Business business;
      private String role;
  
      public Business getBusiness() {
          return business;
      }
  
      public void setBusiness(Business business) {
          this.business = business;
      }
  
      public String getRole() {
          return role;
      }
  
      public void setRole(String role) {
          this.role = role;
      }
  
  
  
  }
  </code></pre>
  
  <p>while here's my 
  <strong>Business.java</strong></p>
  
  <pre><code>import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  
  @Entity
  @JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
  public class Business  {
  
  
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      Long businessId;
      String businessName;
  
  
  
  
      Business(){
          super();
      }
  
      public Business(Long businessId, String businessName, String businessOwner, String username, String role){
          this.businessId = businessId;
          this.businessName = businessName;
      }
  
  
  
  
  
  
  }
  </code></pre>
  
  <p>I've checked some other questions here and suggested that I use persistence and I did but I somehow I can't make it work</p>
  
  <p>anyone knows the problem? stuck here for hours</p>