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

  • Home
  • SEARCH
  • 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 9250895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:33:35+00:00 2026-06-18T10:33:35+00:00

In my application, I have two classes: Activity and User . The relationship among

  • 0

In my application, I have two classes: Activity and User. The relationship among them are:

  • An activity can have multiple user. I have a field List<User> for this purpose in Activity class.
  • An user can belongs to multiple activities and in each activity he/she can have a specific role. I have refined a Map<String, String> in User, where the key of this Map is the activityId and the value is roleId. I don’t have any Role table, as there are only four predefined Roles.

I am unable to understand should there be any ManyToOne or OneToMany or ManyToMany relationship between User and Activity. Or should I simple store the whole List<User> object along with Activity and Map<String, String> with User in database. If so, how can I store a whole List and a Map.

Any pointer would be very helpful for me.

  • 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-18T10:33:36+00:00Added an answer on June 18, 2026 at 10:33 am

    I would first think about how the design would be in database. If I understand correctly, you would have 3 tables:

    • User
    • Activity
    • Participation

    where Participation would have a foreign key to a user, a foreign key to an activity, and a role.

    So I would map that simply as

    • User has a OneToMany with Participation
    • Activity has a OneToMany with Participation

    And of course you can make these two associations bidirectional.

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

Sidebar

Related Questions

I'm making a shopping list mobile application (Java ME) and i have two classes;
I have two async classes in my application which you can see below class
I have two view controller classes in my application delegate. I can change from
In my Android application, I have two activity classes. I have a button on
I have two classes in a PHP application, B extending A for example. Class
Say I have two classes like this: class A{ private static Random random =
Suppose I have two classes in a Rails application: class Subject < ActiveRecord::Base def
In our application we have two or three classes which contains the entire Java
I am writing an android application and I need to have two classes use
I have an application that can display items in two different ways, in rows

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.