greece87
greece87

Reputation: 3

How to use foreach between 2 entities

Hello I have 2 entity

One is User and the other one is UserRight. What I want to do basicly; I want to make a list called : userRightViewList and after creating list, I want to make a for each statetement for my entiy called "User". And make another foreach statement for "userRight" and userRight for statement needs to take loginName entity for User my entites below;

User;

private String loginName;
    private String password;
    private char gender;
    private String name;
    private String surname;
    private Date dateOfBirth;
    private Date createAt;
    private Character isLocked;
    private Character isBanned;
    private String email;
    private String gsm;
    private String companyCode;
    private String isActive; 

UserRight;

private String accessRightCode;
    private String companyCode;
    private String isActive;
    private String loginName;
    private String name;
    private String surname;
    private String vendorId;

Upvotes: 0

Views: 216

Answers (1)

user9945564
user9945564

Reputation:

Edit your User class to add a field such as

private List<UserRight> userRight

I dont know what you are triying to do, but I think you're modeling it in the wrong way.

Upvotes: 2

Related Questions