Question about Criteria Queries and Projections

"Geoffrey Samper" <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nhibernate.devel
Message-ID <[email protected]>
Hi,

I have a problem with writing Criteria Query. To explain the problem I
create a small model.
We have two entities Contract and ContractHistory.
- There is a many-to-one association defined on ContractHistory called
Contract.
- On the Contract there is a bag defined called Histories.

Here the problem
I want to return an object array that contains a HistoryList and the
Contract.

In hql in you can do like this
select c, ch from Contract c join c.Histories ch
The query will return a new object[]{Contract, IList<ContractHistory>}

I don't know how that I can do this with Criteria Queries. What I can do is
returning individual properties of the ContractHistory and Contract using
the Criteria Query.
For example:
 ICriteria c = session.CreateCriteria(typeof(Contract), "c")
.SetProjection(Projections.Property("c.Name"));

This Criteria Query translate in Hql is select c.Name from Contract c join
c.Histories ch

Thank for you time.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php

_______________________________________________
Nhibernate-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nhibernate-development
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.