I have the following 2 classes:

public abstract class AbstractProduct : Entity
{
        public virtual ISet<Price> Prices { get; set; }
}

public class Price : Entity
{
        public virtual AbstractProduct AbstractProduct { get; set; }
        public virtual decimal Amount { get; set; }
        public virtual decimal Quantity { get; set; }
        public virtual DateTime? Expires {get; set;}
}

I want to get products ordered by unit price.  The SQL I supposed is:
            select p0.*, (select min(pr.amount) from "Price" pr
                            where pr.abstractproduct_id=p0.id
                                and pr.Quantity = 1
                                and (pr.expires>'2009-7-1' or
pr.expires is null)
                            )as amount
            from "AbstractProduct" p0;
            order by amount;

I tried it in Postgresql, it returns correct result. but I don't know
how to code it with the Criteria API.

Can anybody help me?
Thanks!

--~--~---------~--~----~------------~-------~--~----~
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