What output-sql should nhibernate generate for id with two or more columns?
On Sep 14, 4:40 pm, Dietrich <[email protected]> wrote: > Something like "Select * From Table1 WHERE Table1ID in ( select > table1ID from table2 where table2.whatever = 'whatever' union select > table1id from table3 where table3.whatever2='whatever' )" > > I found a method using the QueryOver<T> API to do this without having > to encode the ID field as a string, so that's a benefit, but I'm still > forced to provide a Lamda for the location of the ID property. > > Session.QueryOver<Table1>().Where(Subqueries.WhereProperty<Table1>(t > => t.table1id).In(SubQueryOver).List(); > > I was hoping there'd be something like Where(Subqueries.WhereID().In, > but that may not exist. > > On Sep 13, 1:11 pm, Nik Govorov <[email protected]> wrote: > > > > > > > > > What output-sql would you like to have? > > > On Sep 13, 5:23 pm, Dietrich <[email protected]> wrote: > > > > As soon as I hit send, I found the IdentifierPropertyName property of > > > the IClassMetadata interface.. sorry. > > > > Still would be interested to know if this is the best way to handle > > > Subqueries against an ID. > > > > On Sep 13, 9:20 am, Dietrich <[email protected]> wrote: > > > > > I think I'm missing something here. > > > > > I've got some code that builds DetatchedCriteria instances that always > > > > end with .SetProjection(Projections.ID()); > > > > > I'd like to use these in a Subquery statement later on, but I can't > > > > figure out the easiest way to do it. > > > > > It seems like you can do Subqueries.PropertyIn(IDFieldName, DCthing), > > > > but in order for that to work you will have to know what the ID field > > > > is named for any given class. Is there an easy way to get the name of > > > > the ID field? I'm looking in the IClassMetadata area and nothing is > > > > immediately apparent. > > > > > Is there a better Subquery I should use for this? I was surprised not > > > > to see a Subqueries.IDIn(DetatchedCriteria DC) method, maybe it's > > > > under a different name? -- 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.
