Thursday, 22 August 2013

Hibernate getting data from querry with case

Hibernate getting data from querry with case

I'm fetching data from DB with following query:
with t1(x) as(
select level - 1
from dual
connect by level <= 4
select * -- actual query
from t1
order by case x
when 0 then 'expire'
when 1 then 'approval'
when 2 then 'pending'
when 3 then 'counting'
end
I need to perform this query by using Hibernate.
1) Could you tell me if it's possible to get query with following criteria?
criteria.createAlias(sortField,
sortField + ", CURRENT_DATE " + newNameFromCase);
If not, what do I have to do to get Result from my query?
I have looked for Hibernate annotations but did not find anything.
I must add that my project is not using XML configuration file for hibernate.

No comments:

Post a Comment