Howdy y'all,
supposed I have a simple scenario like this (and mappings are
correctly set up in *.hbm.xml):
public class Foo
{
// id and so on omitted
public virtual Bar BarRef { get; set; }
}
public class Bar
{
// id and so on omitted
public virtual string Name { get; set; }
}
With HQL I can do this:
select b from Foo f inner join f.BarRef b where b.Name = "1887"
Even though I'm starting at a Foo I can return a Bar. Is something
similar possible with ICriteria?
I tried this (and different stuff):
ISession session = GetSessionFromSomewhere();
ICriteria criteria =
session
.CreateCriteria<Foo>()
.CreateAlias( "BarRef", "b" )
.Add( Expression.Eq( "b.Name", "1887" )
);
// BOOM
criteria.List<Bar>();
Searching the net I found no examples like that, neither in NHibernate
in Action...
Are ResultTransformers or Projection what I need?
Regards,
void*
--
To unsubscribe, reply using "remove me" as the subject.