title: Caused by: java.lang.IllegalArgumentException: Not a managed type: & Caused by: org.hibernate.AnnotationException: No identifier specified for entity:
body: <p>I have created two entity classes.</p>
  
  <p>RoleEntity:</p>
  
  <pre><code>import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.Id;
  import javax.persistence.Table;
  
  @Entity
  @Table (name ="roles")
  public class RoleEntity {
  
  @Id
  @Column(name = "role_id")
  private Integer roleId;
  @Column(name = "role_name")
  private String roleName;
  //Getters
  //Setters
  </code></pre>
  
  <p>UserEntity:</p>
  
  <pre><code>import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.Id;
  import javax.persistence.Table;
  
  @Entity
  @Table(name="user_master")
  public class UserEntity {
  
  @Id
  private Integer id;
  @Column(name = "user_name")
  private String username;
  @Column(name = "user_password")
  private String password;
  //getters
  //setters
  </code></pre>
  
  <p>Now i have a simple pojo which will take data from these two entities and later will be used in a service.</p>
  
  <pre><code>import java.util.Set;
  
  public class UserRoleAssociationEntity {
  
  UserEntity user;
  Set&lt;RoleEntity&gt; roles;
  //getters
  //setters
  </code></pre>
  
  <p>Now I am getting error when I run the project.</p>
  
  <pre><code>Caused by: java.lang.IllegalArgumentException: Not a managed type: class com.dataGuru.BusDirV3.Entities.UserRoleAssociationEntity
  </code></pre>
  
  <p>If I annotate the UserRoleAssociationEntity class with @entity i get the following error:</p>
  
  <pre><code>Caused by: org.hibernate.AnnotationException: No identifier specified for entity: com.dataGuru.BusDirV3.Entities.UserRoleAssociationEntity
  </code></pre>
  
  <p>What is the problem which i am facing here &amp; solution for this problem.</p>