DECODE « Oracle « JPA Q&A

1. Problem with the function DECODE in Oracle

Hi guys, I have to execute a complexe SQL Request on Oracle DataBase. My request uses an Oracle function like this : SUM(DECODE(table.field,value,1,0) The problem is that when I try to execute this request through Hibernate I get the following exception : net.sf.hibernate.QueryException: undefined alias: decode [..... Obviously Hibernate does not understand the DECODE function. How could I make it understand ...

2. Using Oracle Decode with Hibernate Criteria

3. Oracle's decode function