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 8953163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:02:39+00:00 2026-06-15T14:02:39+00:00

I have the three entities Person , Task and Note that should behave as

  • 0

I have the three entities Person, Task and Note that should behave as follows:

  • One person can have multiple tasks
  • One task can be assigned to multiple persons
  • Each person can have for a task multiple notes attached.

Based on this I have the following tables:

Person     Task    Person_Task    Note           Person_Task_Note
-------    ----    -----------    -----------    ----------------
id         id      id             id             id
name       name    person_id      description    person_task_id
                   task_id                       note_id

with the folowing relationships:

  • Many-To-Many between Person and Task using Person_Task as join table
  • One-To-Many between Person_Task and Note using Person_Task_Note as join table

Now I’m trying to map this structure using JPA2 with Hibernate.
My goal would be to have in the code only the three base entities with the following options:

  • Get all tasks for a person (person.getTasks())
  • Get all notes for a person’s task (task.getNotes())

I am aware that I can map every single table to a class and then then retrive the necessary info with a fat JPA criteria query.

However, I would like to avoid (if possbile) creating classes for the join tables.

If I map the relationship between Person and Task using @ManyToMany I don’t currently see how I can proceed further to retrive the Note entries

Is it possbile to do this kind of mapping just by using the JPA annotations without writing classes for the join tables?

  • 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-06-15T14:02:40+00:00Added an answer on June 15, 2026 at 2:02 pm

    No, it’s not possible. You’ll have to map all the tables, and transform your ManyToMany between Person and Task into two OneToMany associations.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three entities. Author Newspaper Dissertation Newspaper and Dissertation both can have one
If I have three entities, Project, ProjectRole and Person, where a Person can be
I have a case where i have three entities with one-to-many and one-to-many relationships:
I have Person and Course Entities With multiple relationships: public class Course { public
I have a table to entities (lets call them people) and properties (one person
I have profiles and studies. One person can finish many studies. The form renders
I have three basic types of entities: People, Businesses, and Assets. Each Asset can
I have an entity model with User and Person entities, such that each User
I have three entities: Country, State and City with the following relationships: When creating
I have three entities: EntityA, EntityB and EntityC connected with to-many relationships. See schema

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.