I totally understand that native sql is one of my options.  However I
need this join as part of a complex search query.  I did not include
the rest of the query simply for the sake of brevity.

So it seems that join does not work for many-to-many.  Is that
correct?


On Jan 21, 9:38 am, Fabio Maulo <[email protected]> wrote:
> http://fabiomaulo.blogspot.com/2009/09/nhibernate-queries.html
>
> Note: SQL is one of your options
>
> 2010/1/20 welzie <[email protected]>
>
>
>
>
>
> > Thanks for the suggestion, but that creates this SQL which does NOT
> > join the tables using the "in between table".  I end up with duplicate
> > results.
> > select audit0_.Id as Id9_,
> > audit0_.Active as Active9_,
> > audit0_.DateAudited as DateAudi3_9_,
> > audit0_.AuditorId as AuditorId9_,
> > audit0_.ClaimId as ClaimId9_,
> > audit0_.SpecialProjectId as SpecialP6_9_
> > from audits audit0_, audittypes audittype1_
> > where audittype1_.Id in (1,2,3,4,5)
>
> > What I really need is HQL to create SQL that looks like the below.
> > Any more suggestions?
> > select *
> > from audits
> > join audit_audittypes on audit_audittypes.auditId = audits.id
> > join auditTypes as at on at.id = audit_audittypes.auditTypeId
> > where at.id IN (1,2,3,4,5,6,7)
>
> > On Jan 20, 5:10 pm, Graham Bunce <[email protected]> wrote:
> > > Something like;
>
> > > SELECT au FROM Audit au JOIN au.AuditTypes at
> > > WHERE at.id IN (:ids)
>
> > > I think
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "nhusers" group.> To post to this group, send email 
> > [email protected].
> > To unsubscribe from this group, send email 
> > to>[email protected]<nhusers%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.
>
> --
> Fabio Maulo
-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.


Reply via email to