Register / Login
Object Relational Mapping
Hibernate criteria search problem
posted 8 years ago
I'm using the Criteria api for building queries. Now I have bumped into
a sorting problem.
My Item class has a price and a discount. The Item class has a many to one relation with a Collection class. The Collection class also has a discount.
The Items discount superseeds the collection discount.
So when getting the discount in my class I use
discount > collection.discount ? discount : collection.discount
My problem no is sorting on price. I want to sort on
price - the item discount if larger then collection discount else collection discount multiplied by the price
My problem is that I can't this to work in my criteria. Any pointers?
[ May 21, 2008: Message edited by: Mathias Nilsson ]
Problem with session
a modelling problem
OJB Criteria and foreign keys