-->
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.  [ 2 posts ] 
Author Message
 Post subject: Easy Query?
PostPosted: Wed Oct 31, 2007 6:31 am 
Newbie

Joined: Wed Oct 31, 2007 6:17 am
Posts: 2
Hi list,

I need to realize the following query using criterias and expressions:


SELECT columnA, intColumnB, intColumnC, intColumnD FROM table1 WHERE inColumnB>(intColumnC+intColumnD).

Right now I have no ideai how to do the WHERE CLAUSE. Does anybody have a hint how to do this?

regards,

hyperfoo


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 31, 2007 11:18 am 
Regular
Regular

Joined: Mon Jan 22, 2007 10:32 am
Posts: 101
Add a formula property in you mapping like

<property name="sumCD" formula="intColumnC+intColumnD"/>

and add the restriction like

criteria.add(Restrictions.gtProperty("intColumnB", "sumCD"));

HTH

_________________
Please rate this post if you find it helpful


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

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.