-->
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.  [ 3 posts ] 
Author Message
 Post subject: cannot use SQL functions in formula
PostPosted: Mon Dec 05, 2005 3:01 pm 
Regular
Regular

Joined: Thu May 12, 2005 10:12 am
Posts: 71
Location: Buenos Aires, Argentina
Hi, I was trying to use the formula feature in a property and was unable to do a query with order by DESC or select TOP 1 because NH kept replacing these functions with the internal table name for the class...

Is there a way to indicate to hibernate that those commands are not ment to be replaced?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 05, 2005 4:46 pm 
Newbie

Joined: Thu Oct 20, 2005 5:17 pm
Posts: 19
If you're using HQL, the order by clause should work fine.

"... order by object.property desc"

If you only want the first result, then use the SetMaxResults(1) method.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 07, 2005 5:27 pm 
Regular
Regular

Joined: Thu May 12, 2005 10:12 am
Posts: 71
Location: Buenos Aires, Argentina
I realize I could do it with HQL, but I had the problem using the formula in the HBM files with a derived property.

With derived properties you can input a SQL statement to produce the desired property, but when I use order by or TOP it get's rendered incorrectly.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.