-->
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: conditional select
PostPosted: Mon Apr 18, 2005 4:37 am 
Newbie

Joined: Mon Apr 18, 2005 4:22 am
Posts: 2
Hello ! I am using Hibernate version:2.1.6 with
MySQL 4.1.7.
I have a table that has two columns that would represent a date:
month and year. I want to select a row that's month and year are before the specified month and year, which means the year is <= than the specified one, and the month would also be <= than the specified month, or max(month) if the year is < than the specified year.
I would like to do that within only one Hibernate query, and would also prefer not to make any redundant queries. I was thinking of using the xor logical operator between two subselects that represent the two cases, but this one would fail if both of the subqueries would give results. The "xor" operator or even "or" would work if I used a temporary variable that was instantiated if the first select succeeded, but I don't know if it's possible to use variables in the Hibernate queries.

Could you please help me with this matter?
Thank you in advance !


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.