Have you tried

var entries = SessionSource.Current.GetSession().CreateQuery("from
TimeEntry te join fetch te.Project where te.ProjectState
= :ps").SetParameter("ps", ProjectState.Auftrag).List<TimeEntry>();

?

On Apr 18, 5:21 pm, Peter Forstmeier <[email protected]>
wrote:
> Hi,
> and thanks for the answer.
> I'm not fixed with LINQ, i can run the Query in plain old HQl as well.
> But, i have no idea how to write down the query.
>
> Peter
>
> On 18 Apr., 17:15, Ricardo Peres <[email protected]> wrote:
>
>
>
>
>
>
>
> > You are using the "old" NHContrib LINQ provider; NHibernate now has
> > it's own provider in the core (Query<T> extension method instead of
> > Linq<T>).
> > I don't know if the "old" provider supported enums, perhaps someone
> > else can help with that.
> > BTW, is the References line commented out?
>
> > RP
>
> > On Apr 18, 1:05 pm, Peter Forstmeier <[email protected]>
> > wrote:
>
> > > Hi List,
> > > i have a TimeEntry Table and get tho whole table by:
> > >  List<TimeEntry> source =
> > > SessionSource.Current.GetSession().Linq<TimeEntry>()
>
> > > now i would like to use a constraint that only returns TimeEntry's
> > > that have a ProjectState of ProjectState.Done in the associated
> > > ProjectsTable.
> > > Something like this:
> > >   List<TimeEntry> source =
> > > SessionSource.Current.GetSession().Linq<TimeEntry>().
> > >                 Select(Session.Linq<Project>().Where(p =>
> > > p.ProjectState == ProjectState.Auftrag));
>
> > > TimeEntry has a ForeignKey to Project.
>
> > > The mapping looks like:
> > >    Id(x =>
> > > x.Id).GeneratedBy.GuidComb().UnsavedValue("00000000-0000-0000-0000-00000000
> > >  0000");
> > >             Map(x => x.WorkDate).Not.Nullable().Length(8);
> > >             Map(x => x.WorkTime).Not.Nullable();
> > >             Map(x => x.Job);
> > >             Map(x => x.ProjectGuid);  --------- FK to Project
> > >             Map(x => x.EmployeeGuid);
> > >             // References(x =>
> > > x.Project).Not.LazyLoad().Cascade.SaveUpdate();
> > >             SelectBeforeUpdate();
> > >             DynamicUpdate();
>
> > > Thanks
> > > Peter- Zitierten Text ausblenden -
>
> > - Zitierten Text anzeigen -

-- 
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