I have 2 tables email_address and group_email
email_address id name email is_group
group_email id group_id (one to many relationship with id filed email_address table) email_addr_id (one to many relationship with id filed of email_address table )
I want to get list of email_addresses and if it is group then also list of group email addresses. How should I configure entity?
@Entity @Table(name = "email_address") public class EmailAddressDom { @Id @Column(name = "id") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "email_address_id_seq") @SequenceGenerator(name = "email_address_id_seq", sequenceName = "email_address_id_seq") private int id;
@Column(name = "name") private String name;
@Column(name = "email") private String email;
@Column(name = "is_group") private boolean isGroup;
// which annotation should be there private List<EmailAddressDom> groupEmails;
|