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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:57:18+00:00 2026-06-05T14:57:18+00:00

I have a mapping with a composite key as below: CompositeId() .KeyReference(x => x.CreatedBy,

  • 0

I have a mapping with a composite key as below:

CompositeId()
            .KeyReference(x => x.CreatedBy, "member_key")
            .KeyReference(x => x.Box, "box_key");

This works fine for simple gets and inserts, however it is not generating joins with the tables mentioned in the reference where I try and use them as part of a query.

So this:

return _sessionFactory.GetCurrentSession().QueryOver<BoxMember>()
            .Where(x => x.Box.Id == boxId)
            .Where(x => x.Member.DeletedDate == null)
            .Fetch(x => x.Box).Eager
            .Fetch(x => x.CreatedBy).Eager
            .List();

Generates the following SQL:

    SELECT this_.member_key     as member1_5_0_,
       this_.box_key        as box2_5_0_
FROM   box_member this_
WHERE  this_.box_key = '2750e160-ba72-4a70-b554-9fd600e3cfd0' /* @p0 */
and    m1_.deleted_date is null;
  • 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-05T14:57:20+00:00Added an answer on June 5, 2026 at 2:57 pm

    I had exactly the same issue. Adding Reference mapping helped, but the issue makes no sense anyway:

    Try this:

    CompositeId() 
                .KeyReference(x => x.CreatedBy, "member_key") 
                .KeyReference(x => x.Box, "box_key"); 
    Reference(x => x.CreatedBy);
    Reference(x => x.Box);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to have a mapping function that does this: public static void
I have some troubles mapping a JSON Array to RestKit. This is what the
I have the following two tables: Jobs AreaID, JobNo (composite key) Logs LogID, AreaID,
I have entity that has a version. It has composite primary key where one
I have the following classes: class Catalog { static mapping = { id composite:['name',
I have a composite primary key table (Maintenance Items). I would like to create
So I have a class that has a composite primary key: public class Field
I have two tables: <class name=Content table=language_content lazy=false> <composite-id> <key-property name=contentID column=contentID/> <key-property name=languageID
I have read that this mapping is not possible in NHibernate 3.3: <class name=Digital
i have mapping like this: @URLMapping(id = edituser, pattern = /edituser/#{ id: userBean.userId}, viewId

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.