-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: CreteriaExpressions using where and joins
PostPosted: Fri Dec 09, 2005 4:55 am 
Hi,

There are no good samples available on the web related to CreteriaExpressions(similar to where conditions and joins on the multiple table in SQL).

Please suggest me few examples using ExpressionCreteria with where and joins on multiple persistence class.
Eg:
select a.Name, a.Addr , c.Workplace from Emp a, Contractor c
where a.Id=c.Id and a.Name Like 'An%'
order by a.Name


Thanks,
Suman


Top
  
 
 Post subject:
PostPosted: Sat Dec 10, 2005 8:11 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
There are load of examples in NHibernate.Tests :wink:

Here is one (from NHibernate.Test\FooBarTest.cs):
Code:
IList list = s.CreateCriteria( typeof( Foo ) )
   .Add( Expression.Expression.Eq( "Integer", f.Integer ) )
   .Add( Expression.Expression.EqProperty( "Integer", "Integer" ) )
   .Add( Expression.Expression.Like( "String", f.String ) )
   .Add( Expression.Expression.In( "Boolean", new bool[ ] {f.Boolean, f.Boolean} ) )
   .SetFetchMode( "TheFoo", FetchMode.Eager )
   .SetFetchMode( "Baz", FetchMode.Lazy )
   .List();

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.