Hi all,
I'm using NHibernate 2.1.2.400, and I'm having an issue with a an
ISQLQuery query.
The reason why I use an ISQLQuery here, is that this query uses a
table for which I have no entity mapped in NHibernate.
The query looks like this:
ISQLQuery query = session.CreateSQLQuery (
"select p.*, price.* " +
"from prestation p left outer join prestationprice price on
p.PrestationId = price.PrestationId " +
"where p.Id IN ( select id from prestationregistry where ...");
'Prestationregistry' is the table that is not known by NHibernate
(unmapped, so therefore the native SQL Query).
my code continues like this:
query.AddEntity ("p", typeof(Prestation));
query.AddJoin ("price", typeof(PrestationPrice));
query.SetResultTransformer (Transformers.DistinctRootEntity);
var result = query.List();
So far so good.
I expect that I'm given a list of 'Prestation' instances as a result
of this query, since I declared 'Prestation' as being the root-object
that has to be returned by the AddEntity method.
I also expect that the PrestationPrices for each Prestation are
eagerly loaded by this query (hence the AddJoin method).
To my surprise, the List() method returns a collection of
PrestationPrice instances instead of Prestation instances.
How come ? Am I doing something wrong ? And if so, could you be so
kind to tell me what I'm doing wrong ?
Or, is this a bug ?
--
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.