Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7584371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:54:16+00:00 2026-05-30T18:54:16+00:00

I have some doubts in JPA. I have one Employee table and Project table.

  • 0

I have some doubts in JPA. I have one Employee table and Project table. When the values are saved in Employee and Project tables have no relation. The scenario is first, admin should be able to create the Employee and Project. Later project manager assigns each employee to different project. Here how do I write the values to the table called employee_project_assignment?

employee_id project_id
----------- ----------
100     ABC987
100     DEF876
101     ABC987
102     DEF876

The UI will be like the following way.

When the EmployeeProjectAssignment form comes,Project Manager selects one project from different projects from the dropdown. And he selects multiple employees whom he wants to that project. In this
way. So how do I create the entity for this EmployeeProjectAssignment form?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T18:54:18+00:00Added an answer on May 30, 2026 at 6:54 pm

    The above table is a pure join table used to materialize the ManyToMany association between Employee and Project.

    The Employee entity could have a collection of Projects, and/or the Project entity could have a collection of Employees (i.e. teh relation can be unidirectional from Employee to Project, or unidirectional from Project to employee, or bidirectional).

    Decide which kind of association better fits your needs (in general, a bidirectional one makes life easier). If bidirectional, choose which side is the owner of the association (the owner side has a @JoinTable annotation, and the other side has a mappedBy attribute), and then in your form handling method, populate the collections. The owning side is the side that must be populated for JPA to persist the association.

    Suppose the owning side is Employee:

    employee.getProjects().clear();
    employee.getProjects().addAll(projectsSelectedByAdministrator);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to make a mapping One by One, and I have some doubts.
i'm writing my first plugin for wordpress and i have some doubts regarding the
I am using Codeigniter to build my project. Here i have some doubts or
I'm using NHibernate and I have some doubts abour how NHibernate handles null values
After reading this article about validating with service layer I have some doubts. First:
I have some doubts. What is querystrng? how we can use it? what are
I have some doubts about construction and initialization order guarantees in C++. For instance,
I have programmed an emulator, but I have some doubts about how to organizate
I'm a beginner about javascript, and I have some doubts about the variables of
im currently learning python (in the very begining), so I still have some doubts

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.