-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Complex DetachedCriteria
PostPosted: Fri Jun 29, 2007 11:22 am 
Newbie

Joined: Wed Jun 20, 2007 7:20 am
Posts: 5
Hi all,

I am struggling with a complex DetachedCriteria Query.....but I am stuck on it.

My domain has this classes:

- Customers (with a one-to-many of Orders)
- Orders (with a one-to-many of OrderDetails)
- OrderDetails (with a many-to-one of Orders and a many-to-one of Product)
- Product

OrderDetails has two propery Quantity and UnitPrice

I need to retrieve all Customers that bought a subset of products in a range of date and the sum of the "subset" of products must be between a range of decimal values

What I wrote is:
Code:
DetachedCriteria query = DetachedCriteria.For(typeof(Customer), "customer");

DetachedCriteria economicCriteria = query.CreateCriteria("Orders","orders");
economicCriteria.Add(Expression.Between("OrderDate", FirstDate, SecondDate));

DetachedCriteria detailCriteria = economicCriteria.CreateCriteria("Detail","detail");
detailCriteria.Add(Expression.And(Expression.In("Product", ProductIdList), ?????? MY PROBLEM IS HERE ??????));


Where you see the ??????????? is where I stuck.
What have I to write there to say to the criteria that the total import of products (ProductIdList) is between DecimalValue1 and DecimalValue2?

Thank you in advance[/u][/b]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.