[hibernate-dev] Issue with rownumber in db2

charly prabakar j_charlyprabakar at hotmail.com
Sun Sep 19 09:51:32 EDT 2010





Hi,


I’m trying to connect to DB2 using Hibernate through Grails framework.
 
I have specified the table and column names in hibernate mapping file. 
Hibernate internally generate the queries to connect to the db and return results.
 
Below is the query generated by Hibernate to return results from MYSCHEMA.INQ_TYP table.
 
select * from
        ( select rownumber() over() as rownumber_,
            this_.INQ_TYP_CDE as INQ1_20_0_,
            this_.CRAT_USER_ID as CRAT2_20_0_,
            this_.INQ_TYP_NME as INQ3_20_0_
        from
            MYSCHEMA.INQ_TYP this_ ) as temp_
    where
        rownumber_ <= 2
 
This returns error as there is no rownumber in db2 zOs.


When I searched the forums, I found similar questions but there was no answers.


One of the links I saw
http://www.mail-archive.com/jboss-user@lists.sourceforge.net/msg114824.html


Is it possible to avoid rownumber in the sql query?


Appreciate all the help.


Thanks. 		 	   		  


More information about the hibernate-dev mailing list