0

I have START_TIME (timestamp) and AVAILABLE_PERIOD (number) columns in my Table.

Is there a way I can query the table with a condition like current_time < (START_TIME + AVAILABLE_PERIOD) using hibernate criteria?

Same question is asked here. But no answer.

Community
  • 1
  • 1
Darshana
  • 2,462
  • 6
  • 28
  • 54
  • Did you look at http://stackoverflow.com/a/18208519/672841? – Can't Tell Nov 04 '15 at 04:11
  • The problem with my situation is, my `START_TIME` and `AVAILABLE_PERIOD` is **not** in same data type. – Darshana Nov 04 '15 at 04:15
  • what data types are they? And I think you should be able to do any conversion you do with SQL by calling SQLcriteria method, – Can't Tell Nov 04 '15 at 04:16
  • `START_TIME` in date format and `AVAILABLE_PERIOD` in integer – Darshana Nov 04 '15 at 04:22
  • Can you do what you are trying to achieve using SQL? If so passing that SQL to sqlCriteria should work. If you can't do that using plain SQL I don't think you will be able to do that using hibernate. But then again, I'm not a Hibernate expert. – Can't Tell Nov 04 '15 at 04:25
  • thank for the comments. using SQL functions will make the criteria DBMS specific here. – Darshana Nov 04 '15 at 05:08

0 Answers0