@Entity
@Table(name = "USUARIO")
public class Usuario implements Serializable {
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
@Column(name = "ID")
private Long id;
@Column(name = "USER_NAME", nullable = false)
private String userName;
}
@Entity
@Table(name = "CARGO")
public class Cargo implements Serializable {
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
@Column(name = "ID")
private Long id;
@Column(name = "NAME", nullable = false)
private String name;
}
@Entity
@Table(name = "USUARIO_CARGO")
public class Cargo implements Serializable {
@JoinColumn(name = "USARIO_ID")
private User user;
@JoinColumn(name = "CARGO_ID")
private Cargo cargo;
}