Me again,
i changed the query a little because i can't get your idea to work.
   var entries1 =
               SessionSource.Current.GetSession().CreateQuery(
                   "from  Project p join TimeEntry te where p.Id =
te.ProjectGuid and p.ProjectState = :ps").SetParameter("ps",
ProjectState.Auftrag).List();

i get the following error:

Path expected for join! [from  ProjectTracker.Domains.Project p join
TimeEntry te where p.Id = te.ProjectGuid and p.ProjectState = :ps]

Peter


On 19 Apr., 13:57, Peter Forstmeier <[email protected]>
wrote:
> Hi,
> i will give them a try, but, i'm interested in a LNIQ Solution as well
>
> Thanks
> Peter
>
> On 18 Apr., 19:46, Ricardo Peres <[email protected]> wrote:
>
>
>
> > 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 -- Zitierten Text ausblenden -
>
> > - Zitierten Text anzeigen -- 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