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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:37:31+00:00 2026-05-24T07:37:31+00:00

Got a bit of an unusual problem – i’m sure i’m missing something really

  • 0

Got a bit of an unusual problem – i’m sure i’m missing something really simple now!
Have two tables in particular:

   <class name="Proposal" table="Proposal">
      <id name="Id" column="ProposalId">
         <generator class="identity" />
      </id>

      <property name="QuotationNumber" column="QuotationNumber" access="nosetter.camelcase-underscore" />

      <set name="DataItems" table="ProposalData" inverse="true" cascade="save-update" access="nosetter.camelcase-underscore" lazy="true">
         <key column="ProposalId" />
         <one-to-many class="Fortron.Fastr.Domain.Proposal.ProposalData, Fortron.Fastr.Domain"/>
      </set>
   </class>

and

   <class name="ProposalData" table="ProposalData">
      <id name="Id" column="ProposalDataId">
         <generator class="identity" />
      </id>
      <many-to-one name="Proposal" column="ProposalId" class="Fortron.Fastr.Domain.Proposal.Proposal, Fortron.Fastr.Domain" />

   </class>

I think have a named query in my .HBM.XML file as below:

  FROM Proposal MSP
  JOIN FETCH MSP.DataItems Items

Unless i’m going nutes, given that the Proposal is a one-to-many with ProposalData, NH should load each of the Proposal objects, and the Data for each as a collection.
Unfortunately, i’m ending up with duplicate results, as there are multiple ProposalData for each Proposal.

My understand is this should not be a problem. If ProposalData had a one-to-many with another table, then a Cartesian product would result and the above could be expected.

Am i incorrect? Can anyone shed any light?

Thanks.

  • 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-24T07:37:32+00:00Added an answer on May 24, 2026 at 7:37 am

    JOIN FETCH means that the items are joined and also used to fetch them. This leads to multiplication of the proposals. Note: the duplicates are still the same instances in memory.

    Fix it by using the DistinctRootEntityTransformer or by avoiding join fetch.

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

Sidebar

Related Questions

I've got a bit of a problem with a very simple JQuery bit of
Hey, I've got a bit of a problem right now trying to figure out
I got a bit confused: In production we have two processes communicating via shared
Got a bit of a mind freeze at the moment. I have the following
I've got an NSColor, and I really want the 32-bit RGBA value that it
I've got a select with two 'special' options, a bit like this: <select> <option
I've got a bit of a problem, I'm using a backgroundworker to do a
Have a shiny new Windows 7 64-bit machine and got a bit over zealous
OK, I got bit by something that seems a tad weird. I realize it
I've got a bit of an obscure problem and I'm hoping someone here can

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.