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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:31:09+00:00 2026-06-04T17:31:09+00:00

I have the this objects: class Person { Int32 id; String name; /*..*/ Adress

  • 0

I have the this objects:

class Person { Int32 id; String name; /*..*/ Adress adress; }
class Employee : Person { String e_g_Tax; /*..*/ Guid relationshipToManagmentId; }

And the follow premises for mapping:
(a) The “relationshipToManagmentId” should be a foreign key.
(b) The table “RelationshipToManagment” is a non-mapped table, (a old part of application)
(c) The mapping strategie is TPT. (at least for new objects 🙂

Mapping, until now:

public class PersonMap : ClassMap<Person> {
  public PersonMap(){
    Id(x => x.id);
    Map (x => x.Nachname).Length(255).Not.Nullable();
    /*..*/
    References(x => x.Adresse).Class(typeof(Adresse)).Not.Nullable();
  }
}
public class EmployeeMap : SubclassMap<Employee>
    {
        public EmployeeMap()
        {
            Map(x => x.e_g_Tax, "enjoytax")
                .Not.Nullable();
            /*..*/
            Join("RelationshipToManagment", xJoin =>
            {
                //xJoin.Table("RelationshipToManagment");
                xJoin.Fetch.Join();
                xJoin.KeyColumn("ID");
                xJoin.Map(x => x.relationshipToManagmentId)
                    .Not.Nullable() ;
            }); // --> exception!!

How can i write this?

  • 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-04T17:31:10+00:00Added an answer on June 4, 2026 at 5:31 pm

    Join() can only join on the primary key (property id) to the other table but you need to join on a foreign key column. A normal Reference does what you want

    class Employee : Person
    {
        Management Management;
    }
    
    public EmployeeMap()
    {
        References(x => x.Management).Column("relationshipToManagmentId");
    }
    

    Update: if you need readonly information from the RelationshipToManagment table you could use a formula property

    public EmployeeMap()
    {
        Map(x => x.RelationshipToManagment).Formula("(SELECT m.Title FROM RelationshipToManagment m WHERE m.Id = relationshipToManagmentId)");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have a list of Person objects: class person { int id; string
Hay, I have a Model which looks like this class Person(models.Model): name = models.CharField(blank=False,
I have a class like this: public class Person { Int32 id; Boolean isMarried
If I have this model: class Person(models.Model): name=models.CharField(max_length=28) mother=models.ForeignKey(self,null=True,blank=True) I am trying to make
I have the following Model: public class Person { public string Name {get;set;} public
I have a custom class: public class Person { public String Name { get;
Lets say I have an object class Person { public string Name { get;
I have a model like this: class Person(models.Model,Subject): name = .. The class Subject
I have a Django model that looks something like this: class Person(models.Model): name =
Using Dozer to map two objects, I have: /** /* This first class uses

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.