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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:07:00+00:00 2026-05-26T10:07:00+00:00

I am trying to retrieve the individual detail rows without having to create an

  • 0

I am trying to retrieve the individual detail rows without having to create an object for the parent. I have a map which joins a parent table with the detail to achieve this:

Table("UdfTemplate");
Id(x => x.Id, "Template_Id");
Map(x => x.FieldCode, "Field_Code");
Map(x => x.ClientId, "Client_Id");

Join("UdfFields", join =>
{
    join.KeyColumn("Template_Id");

    join.Map(x => x.Name, "COLUMN_NAME");
    join.Map(x => x.Label, "DISPLAY_NAME");
    join.Map(x => x.IsRequired, "MANDATORY_FLAG")
        .CustomType<YesNoType>();
    join.Map(x => x.MaxLength, "DATA_LENGTH");
    join.Map(x => x.Scale, "DATA_SCALE");
    join.Map(x => x.Precision, "DATA_PRECISION");

    join.Map(x => x.MinValue, "MIN_VALUE");
    join.Map(x => x.MaxValue, "MAX_VALUE");
});

When I run the query in NH using:

Session.CreateCriteria(typeof(UserDefinedField))
    .Add(Restrictions.Eq("FieldCode", code)).List<UserDefinedField>();

I get back the first row three times as opposed to the three individual rows it should return. Looking at the SQL trace in NH Profiler the query appears to be correct. The problem feels like it is in the mapping but I am unsure how to troubleshoot that process. I am about to turn on logging to see what I can find but I thought I would post here in case someone with experience mapping joins knows where I am going wrong.

  • 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-26T10:07:00+00:00Added an answer on May 26, 2026 at 10:07 am

    Found aboutn about SetResults transformer here :

    http://www.coderanch.com/t/216546/ORM/java/Hibernate-returns-duplicate-results

    Which makes your code:

    Session.CreateCriteria(typeof(UserDefinedField))
        .Add(Restrictions.Eq("FieldCode", code))
        .SetResultTransformer(CriteriaSpecification.DistinctRootEntity)
        .List<UserDefinedField>();
    

    Cheers
    John

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

Sidebar

Related Questions

I'm trying to retrieve Inbox items from a specific mailbox (in which i have
Alright Im trying to retrive the number of rows where members are individual and
I'm trying to retrieve information(descriptionand Mail) from my active directory without knowing my DN
I'm trying to retrieve a user object from a foreign key reference but each
Hi i am trying to retrieve data from mysql database to create flot graph
trying to retrieve the id column of records that have their checkboxes selected in
I have a serious problem. Firstly, I am trying to retrieve values from my
I'm trying to write an application which will search and retrieve a user's profile
im trying to retrieve this text on a webpage without the line break: <span
Iam trying to retrieve data from mysql database into stylesheet.php but it is not

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.