DB2 Query to Hibernate Criteria

Posted by Fortega on Stack Overflow See other posts from Stack Overflow or by Fortega
Published on 2010-03-15T11:57:58Z Indexed on 2010/03/15 11:59 UTC
Read the original article Hit count: 257

Filed under:
|
|
|

Hi,

I have a specific DB2 query, and I would like to execute this query using criteria.

The query:

SELECT
 sum(units) as volume,
 location_id, 
 aged
FROM (
 SELECT
   units,
   location_id,

   CASE
    WHEN daysinstock < 61 THEN 'NOT_AGED'
    WHEN daysinstock < 91 THEN 'AGED'
    ELSE 'OVER_AGED'
   END AS AGED 

  FROM 
   STOCK_TABLE
) x
group by location_id, aged

the STOCK_TABLE contains the following fields: units, location_id, daysinstock. This table is matched by a StockDataSource object, with the same fields.

© Stack Overflow or respective owner

Related posts about java

Related posts about db2