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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:02:44+00:00 2026-06-16T07:02:44+00:00

That’s not entirely accurate. I have a user table and some/most Users are Trainers.

  • 0

That’s not entirely accurate. I have a user table and some/most Users are Trainers. There is a UserRole that specifies if a User is a Trainer or an Admin, and that’s the only difference. Perhaps not the cleanest structure, but often Admins are Trainers too and it works fine.

So I’ll have a table like TrainerPayment. It has a some payment information and a Trainer associated with it which of course is a User. so

public int User Trainer {get;set;}

so when I use NH to create the schema I get

PaymentName   varchar(250)
PaymentAmount double
TrainerId     int FK
UserId        int FK

and then NH uses both of those FK’s for different queries. So for instance, If I do a load(trainerId) it generates sql that looks for userid=2. And somewhere else it does a query and uses trainerId. Sorry I forgot where that happened, but I tried to remove the TrainerId and I got an error. I can look it up if you think it would help.

If it’s not clear my question is why do I need both of those FKs ? It really seems like I should only need one.

Thanks,
Raif

  • 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-16T07:02:45+00:00Added an answer on June 16, 2026 at 7:02 am

    I’d guess you have one-to-many on the User that maps to the TrainerPayment? You need to tell that one-to-many that the FK on the TrainerPayment table is called TrainerId, not UserId like the one-to-many will default too.

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

Sidebar

Related Questions

That title is presumably awfully worded. I have some PostgreSQL tables. There is a
That's just my php snippet: $cookies=$_COOKIE['rwt']; $user =mysql_query(SELECT user FROM users WHERE cookies='$cookies'); How
That's pretty much what I am trying to accomplish. To have each image appear
That's how cell selection looks in MS Excel: Is it possible to have the
That sounds complicated, doesn't it... actually it's quite easy: I have a multi-language app
I have just tried to save a simple *.rtf file with some websites and
I have a small JavaScript validation script that validates inputs based on Regex. I
That's what I wanna achieve : There will be dll which contains only methods
That's kinda vague so here's the meaty stuff: I have seen authentication systems that
I have a French site that I want to parse, but am running into

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.