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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:51:45+00:00 2026-06-15T15:51:45+00:00

Code DetachedCriteria criteria2 = DetachedCriteria.forClass(MasterResult.class); criteria2.createAlias(masterCCHolders, masterCCHolders, CriteriaSpecification.INNER_JOIN); criteria2.createAlias(masterFlights, masterFlights, CriteriaSpecification.INNER_JOIN); criteria2.createAlias(masterPassengers, masterPassengers, CriteriaSpecification.INNER_JOIN);

  • 0

Code

        DetachedCriteria criteria2 = DetachedCriteria.forClass(MasterResult.class);
        criteria2.createAlias("masterCCHolders", "masterCCHolders", CriteriaSpecification.INNER_JOIN);
        criteria2.createAlias("masterFlights", "masterFlights", CriteriaSpecification.INNER_JOIN);
        criteria2.createAlias("masterPassengers", "masterPassengers", CriteriaSpecification.INNER_JOIN);
        criteria2.createAlias("masterVendors", "masterVendors", CriteriaSpecification.INNER_JOIN);

this is generating following query

select
    this_.id as id49_4_,
    this_.adults as adults49_4_,
    this_.bookingdate as bookingd3_49_4_,
    this_.children as children49_4_,
    this_.depart_date as depart5_49_4_,
    this_.email1 as email6_49_4_,
    this_.fareprice as fareprice49_4_,
    this_.first_name as first8_49_4_,
    this_.infants as infants49_4_,
    this_.last_name as last10_49_4_,
    this_.phonenumber as phonenu11_49_4_,
    this_.selectiontime as selecti12_49_4_,
    this_.mastercurrentstatus as masterc13_49_4_,
    masterccho2_.master_booking_id as master4_49_6_,
    masterccho2_.id as id6_,
    masterccho2_.id as id47_0_,
    masterccho2_.first_name as first2_47_0_,
    masterccho2_.last_name as last3_47_0_,
    masterccho2_.master_booking_id as master4_47_0_,
    masterflig3_.master_booking_id as master5_49_7_,
    masterflig3_.id as id7_,
    masterflig3_.id as id50_1_,
    masterflig3_.direction as direction50_1_,
    masterflig3_.fromcode as fromcode50_1_,
    masterflig3_.master_booking_id as master5_50_1_,
    masterflig3_.tocode as tocode50_1_,
    masterpass4_.master_booking_id as master6_49_8_,
    masterpass4_.id as id8_,
    masterpass4_.id as id46_2_,
    masterpass4_.first_name as first2_46_2_,
    masterpass4_.last_name as last3_46_2_,
    masterpass4_.master_booking_id as master6_46_2_,
    masterpass4_.middle_name as middle4_46_2_,
    masterpass4_.type as type46_2_,
    mastervend5_.master_booking_id as master4_49_9_,
    mastervend5_.id as id9_,
    mastervend5_.id as id48_3_,
    mastervend5_.locator as locator48_3_,
    mastervend5_.master_booking_id as master4_48_3_,
    mastervend5_.name as name48_3_ 
from
    masterresult this_ 
left outer join
    masterccholder masterccho2_ 
        on this_.id=masterccho2_.master_booking_id 
left outer join
    masterflight masterflig3_ 
        on this_.id=masterflig3_.master_booking_id 
left outer join
    masterpassenger masterpass4_ 
        on this_.id=masterpass4_.master_booking_id 
left outer join
    mastervendor mastervend5_ 
        on this_.id=mastervend5_.master_booking_id 

Query returns 20 rows, which fine, but this also creates 2o Objects of masterResult.

Model structures is like

MasterResult Contains

  • Set of masterCCHolders,
  • Set of masterFlights,
  • Set of masterPassengers,
  • Set of masterVendors

How to solve, this issue ?

1 MasterResult Contains

  • 2 Set of masterCCHolders ,
  • 2 Set of masterFlights ,
  • 5 Set of masterPassengers ,
  • 1 Set of masterVendors,

So total 2*2*5=20 records.

How can I have one masterResult object which contains set of masterCCholder of size 2, set of masterflights of size 2, set of masterpassengers size of 5 and so on.

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-06-15T15:51:47+00:00Added an answer on June 15, 2026 at 3:51 pm
    criteria.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have the following code DetachedCriteria subquery = DetachedCriteria.forClass(Component.class); subquery.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); subquery.createAlias(files, files); subquery.createAlias(files.review,
i have below code snippet in my legacy project DetachedCriteria subCriteria = DetachedCriteria.forClass(Employee.class); subCriteria.setProjection(Projections.distinct(Property.forName
DetachedCriteria criteria = DetachedCriteria.forClass(Parent.class,parent); criteria.createAlias(parent.child,thechild); criteria.add(Restrictions.eq(thechild.property, somevalue); I read many sample code like above,
I'm constructing a Hibernate Criterion, using a subselect as follows DetachedCriteria subselect = DetachedCriteria.forClass(NhmCode.class,
How would you test the following code? public IList<T> Find(DetachedCriteria criteria) { return criteria.GetExecutableCriteria(session).List<T>();
Code sample for my question: IList<TestDataAnimal> testDataFromDb = this.db.TestDataAnimals.Include(t => t.TestType).Include(t => t.Visit).Include(t =>
code: class Node: def __init__(self, key, children=[]): self.key = key self.children = children def
Assuming I run the following code: var placementCriteria = DetachedCriteria.For<ResidentialPlacementClientService>(); placementCriteria.Add(Restrictions.Le(StartDate, effectiveDate)); placementCriteria.Add(Restrictions.Ge(EndDate, effectiveDate));
Code: $(#telecomGrayscale, this).stop().animate({ top: '467px' }, { duration: 400 }).delay(800).queue(function() { $(#boxcaptionTelecom, this).stop().animate({ top:
Code sample should explain things: class A { B* pB; C* pC; D d;

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.