ManyToMany with Additional Fields (EJB Persistence API question)

S

suatkaya74

Hi,

In my database, I've two entities which have many-to-many
relationships, that were connected by a third table, like the
following:

TABLE groups
(
group_id int primary key,
group_name varchar
.....
)

TABLE users
(
user_id int primary key,
user_name varchar
.....
)

TABLE group_membership
(
group_id int,
user_id int,
approved int,
)

I know that I can connect users and groups with @ManyToMany annotation
without having to define a group_membership entity. Now, I have 2
questions:

1. How can I represent the value of "approved" field of the
group_membership table?
2. Is there any way to filter out approved=0 members while defining the
collections in users and groups entities?

Regards,
Suat
 
V

visionset

I know that I can connect users and groups with @ManyToMany annotation
without having to define a group_membership entity. Now, I have 2
questions:

1. How can I represent the value of "approved" field of the
group_membership table?

Have a GroupMembership Entity
2. Is there any way to filter out approved=0 members while defining the
collections in users and groups entities?

See above
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top