Hello Friends, I have a DTO in my project, something like this:
public class ProductDto {
public virtual int Id { get; set; }
public virtual string Name { get; set; }
/* get total of moving inventory to this product*/
public virtual int TotalInventory{ get; set; }
}
So, I did my hql query like this:
public IList<ProductDto> GetActiveProducts()
{
return
Session.CreateQuery(@"select p.Id as Id,
p.Name as Name,
p.Price as Price,
p.Stockas Stock,
/* others properties */
from Product p
where p.Ativo=true")
.SetResultTransformer(Transformers.AliasToBean<ProductDto>())
.List<ProductDto>();
}
It is working fine but I need to fill "MovingInventory" as well. I would
like to know, how can I fetch the column with a subquery (select count(*)
from Inventory where Inventory.Product.Id=Id) ? Is there any way to do this
with HQL ?
PS: THis project is using NHibernate 2.1 GA!
Thanks
--
______________________________________
Felipe B. Oriani -
felipeoriani.com.br | [email protected]
<http://www.twitter.com/felipeoriani> <http://www.facebook.com/felipe.oriani>
<http://br.linkedin.com/in/felipeoriani> <[email protected]>
<[email protected]>
"...Trabalhe quanto puder, tornando-se útil quanto possível..." , por André
Luiz
--
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.