Hi all,
I read in the documentation that NHibernate is able to use some aggregate functions. But I have no clue how I can use them to fill a property of an DTO. Here's the problem:
We have some object tree structures, basically a kind of productgroup hirarchy. Now the guy who's in charge of this structure and the corresponding business processes came to me and gave me his "favorite" ;) SQL statement.
Code:
SELECT succ.outlet_tree_id, COUNT(*) AS level
FROM OUTLET_TREE AS root, OUTLET_TREE AS succ
WHERE succ.lft BETWEEN root.lft AND root.rgt
and root.outlet_tree_id=1
group by succ.lft, succ.outlet_tree_name, succ.outlet_tree_id
order by succ.lft
As you can imagine behind
outlet_tree_id the whole
outlet_tree DTO is "hidden". In the where clause
outlet_tree_id=1 has to be parameterized.
So far I thought about using a named query in the XML mapping file. But I have no clue how I can fill a property with the
level value. There is no corresponding column in the database therefore no information about this property is in the XML mapping file.
Any hints on filling the whole DTO with the additional field for the level value will be very appreciated. :)
Thanks in advance
Chavez