Actually, I do have a Messages collection on the convo. Ok, I just tried it, and it almost works perfectly. One of the criteria I specified got confused between the Message and Conversation, but it works for the most part. Thanks.
On Feb 4, 7:29 am, Chad Lee <[email protected]> wrote: > Also, I don't know what or how your domain is setup, but you could consider > adding a message collection off of the conversation object. NH.Linq can > handle joins that way: > > from conv in session.Linq<Conversation>() > from msg in conv.Messages > where ..... > > On Wed, Feb 4, 2009 at 9:23 AM, Chad Lee <[email protected]> wrote: > > Tuna meant there is no way to join two tables via the Criteria API in > > NHibernate. The linq implementation just translates the linq expression to > > an NHibernate.ICriteria. > > > You'll have to use HQL for now if you need to join on two entities. > > > On Tue, Feb 3, 2009 at 6:53 PM, Joe B <[email protected]> wrote: > > >> You can't have criteria in a where clause or a join clause? I can get > >> rid of the where clause, but I still get the same error. Removing the > >> on clause just won't work syntactically. Surely, other people are > >> joining their data in linq2nh? I can't be the only person trying to > >> do this? > > >> I also tried some other variations, such as (from conversation in > >> Items > >> from message in > >> Messages > >> where > >> message.Conversation == conversation > >> select message) > > >> But I get this error: Unable to cast object of type > >> 'System.Linq.Expressions.ConstantExpression' to type > >> 'System.Linq.Expressions.LambdaExpression'. > > >> On Feb 3, 1:57 pm, Tuna Toksoz <[email protected]> wrote: > >> > There is no way you can do it with criteria so it's not supported in > >> Linq2NH > >> > neither. > > >> > Tuna Toksözhttp://tunatoksoz.comhttp://twitter.com/tehlike > > >> > Typos included to enhance the readers attention! > > >> > On Tue, Feb 3, 2009 at 11:47 PM, Joe B <[email protected]> wrote: > > >> > > So my question is "What is the appropriate way to join two related > >> > > tables in nHibernate?" My workaround forces two calls to the db, --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
