I have a simple native query:
select distinct usr.userid from user usr where usr.name like '%jai%'
which returns me the expected output when used with setFirstResult and setMaxResult. Not
sure whether its a problem with your query or something else.
You can try enabling TRACE level logs of Hibernate package by adding the following to your
jboss-log4j.xml file under the %JBOSS_HOME%\server\< serverName>\conf folder. Then
in your server.log see if you can find something which will help you understand what's
going on. For me, i see logs like this:
2008-06-16 20:38:57,932 TRACE [http-0.0.0.0-8080-2] [org.hibernate.jdbc.AbstractBatcher]
preparing statement
| 2008-06-16 20:38:58,011 DEBUG [http-0.0.0.0-8080-2]
[org.hibernate.jdbc.AbstractBatcher] about to open ResultSet (open ResultSets: 0,
globally: 0)
| 2008-06-16 20:38:58,011 TRACE [http-0.0.0.0-8080-2] [org.hibernate.loader.Loader]
processing result set
| 2008-06-16 20:38:58,011 DEBUG [http-0.0.0.0-8080-2] [org.hibernate.loader.Loader]
result set row: 0
| 2008-06-16 20:38:58,011 DEBUG [http-0.0.0.0-8080-2] [org.hibernate.loader.Loader]
result row:
| 2008-06-16 20:38:58,011 TRACE [http-0.0.0.0-8080-2]
[org.hibernate.type.BigIntegerType] returning '7' as column: ID
| 2008-06-16 20:38:58,011 DEBUG [http-0.0.0.0-8080-2] [org.hibernate.loader.Loader]
result set row: 1
| 2008-06-16 20:38:58,011 DEBUG [http-0.0.0.0-8080-2] [org.hibernate.loader.Loader]
result row:
| 2008-06-16 20:38:58,011 TRACE [http-0.0.0.0-8080-2]
[org.hibernate.type.BigIntegerType] returning '8' as column: ID
| 2008-06-16 20:38:58,011 DEBUG [http-0.0.0.0-8080-2] [org.hibernate.loader.Loader]
result set row: 2
| 2008-06-16 20:38:58,011 DEBUG [http-0.0.0.0-8080-2] [org.hibernate.loader.Loader]
result row:
| 2008-06-16 20:38:58,026 TRACE [http-0.0.0.0-8080-2]
[org.hibernate.type.BigIntegerType] returning '9' as column: ID
| 2008-06-16 20:38:58,026 TRACE [http-0.0.0.0-8080-2] [org.hibernate.loader.Loader] done
processing result set (3 rows)
| 2008-06-16 20:38:58,026 DEBUG [http-0.0.0.0-8080-2]
[org.hibernate.jdbc.AbstractBatcher] about to close ResultSet (open ResultSets: 1,
globally: 1)
| 2008-06-16 20:38:58,026 DEBUG [http-0.0.0.0-8080-2]
[org.hibernate.jdbc.AbstractBatcher] about to close PreparedStatement (open
PreparedStatements: 1, globally: 1)
| 2008-06-16 20:38:58,026 TRACE [http-0.0.0.0-8080-2]
[org.hibernate.jdbc.AbstractBatcher] closing statement
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4158385#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...