we have USERS table:
Code:
...
USER_ID bigint,
USER_NAME text,
...
and SKILLS table:
Code:
...
SKILL_ID bigint,
SKILL_NAME text,
...
and we have "mediator" table, between USERS and SKILLS tables -- USERS_SKILLS:
Code:
...
US_SKILL_ID bigint,
US_USER_ID bigint,
US_SKILL_YEARS bigint,
...
in practice it looks the following way.
there can be many USERS's, each of them has name and id.
also, there are a lot of SKILLS's, each of them as name and id.
each user can set for specified skills how many years he is experienced with it. (record in USERS_SKILLS)
if there is no such record - user has no experience with such skill.
how can we map this correctly?
can you help me with code example's of such mapping?
it would be perfect, if after mapping we will be able to see all SKILLS the following way (i.e. for user with id 1):
getUser(1).getSkills()
and we will have a list of ALL skills (from SKILLS table) and each of them will have information on how many years user is expereinced:
...
(in iteration)
Skill s;
...
s.getYears()
..
Thanks for any help!