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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:23:57+00:00 2026-05-29T18:23:57+00:00

I have a Shop table, a StaffRole table, and a ShopStaffRole table that serves

  • 0

I have a Shop table, a StaffRole table, and a ShopStaffRole table that serves as many-to-many, but with additional fields like IsRequired, etc.

Shop
  ShopId
  ShopName
  ShopAddress

StaffRole
  StaffRoleId
  StaffRoleName

ShopStaffRole
  ShopStaffRoleId
  ShopId
  StaffRoleId
  IsRequired

So my choices seem to be a Shop class and a StaffRole class with NHibernate many-to-many mapping between them, but that won’t map IsRequired well in my object model, so it makes sense to have a ShopStaffRole class as well, and one-to-many mappings between it and both Shop and StaffRole.

However, upon closer inspection, the StaffRole table has only an Id and a Name. Would it make sense to just use an NHibernate join to put the StaffRoleName directly into the ShopStaffRole class as a string, and do away with representing the StaffRole table as a class altogether?

I don’t anticipate the StaffRoleName changing within this application, so I should be able to get away with a read-only mapping that prevents one ShopStaffRole from affecting others with the same StaffRoleName.

Does this make sense, or am I missing something? It feels like my object model is just aping my relational model, table by table.

  • 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-29T18:23:58+00:00Added an answer on May 29, 2026 at 6:23 pm

    As it turns out, I sort of answered my own question. I can’t say it’s never a good idea to do this, but I feel now like there are so many potential gotchas that it’s extremely unlikely to be worthwhile.

    In my case, I realised that although this application wouldn’t have to worry about StaffRole changing, there would be another table that found its way into the scope later on that referenced StaffRole as well, so if we ever wanted to look up a StaffRole of a Shop, then look up all the training material required by this StaffRole, then it would be a good way to have two-way accessors between StaffRole-ShopStaffRole, and StaffRole-TrainingStaffRole.

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

Sidebar

Related Questions

I have a table with structure like that: table name: shop id_shop int(10) name
I have 1 table Products that looks like this: ID Product Shop Color 01
We have a Zend application that has these following modules: Users Shop etc... Front
I have a table with many duplicate records: shop ID tax_id 1 10 1
I have a table playerspoints that contains a shop id and a player's id,
I have a table: Shop (ShopID, ShopName) and a table Campaign (CampaignID, CampaignName) which
I have a table in SQL Server that is structured like this: id Name
I don't have a developer account in the Google play shop and I'd like
In my application I have a string parameter called shop that is required in
I have a table called Product and a table called Shop. Each shop has

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.