[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-19 Thread rabbiaqaswar
Okay, will try this now then. Thanks View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4159295#4159295 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4159295 ___ jboss-user maili

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-19 Thread jaikiran
How about changing your query to return the entire User object instead of just the ids? Maybe like this: SELECT USR FROM USER USR, USERWATCH UW WHERE USR.ADDEDBYID =1 AND USR.COUNTRY = CAS | E WHEN (UW.COUNTRY is null) THEN USR.COUNTRY ELSE UW.COUNTRY END AND USR.ALIVE = 'A' See if that wo

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-19 Thread rabbiaqaswar
I just checked the javadoc of javax.persitence.Query, method setFirstResult and it says: anonymous wrote : Query setFirstResult(int startPosition) | | Set the position of the first result to retrieve. | | Parameters: | startPosition - the start position of the first re

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-19 Thread jaikiran
"jaikiran" wrote : The indexing starts with 1 and not 0. So when setFirstResult(0) is used, it probably gets ignored. I'm sorry. i re-read the javadocs and it appears the indexing does start from 0. "rabbiaqaswar" wrote : | So does that mean that the query is supposed to return Object[] conta

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-19 Thread rabbiaqaswar
So does that mean that the query is supposed to return Object[] containg the result & the index, even if i am only retreiving a single value in the query? View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4159283#4159283 Reply to the post : http://www.jboss.c

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-19 Thread jaikiran
The indexing starts with 1 and not 0. So when setFirstResult(0) is used, it probably gets ignored. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4159282#4159282 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4159282 _

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-19 Thread rabbiaqaswar
Infact it gives ids only when the setFirstResult is set at 0 i.e. setFirstResult(0). When the value of setFirstResult is anything other than 0, the query returns Object[]'s. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4159273#4159273 Reply to the post :

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-19 Thread rabbiaqaswar
One thing which I have noticed is that the query returns ids only for the first ten records. After that, it always returns the Object[] e.g. setFirstResult(20) & setMaxResults(10), also gives Object[]'s. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4159269#4

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-19 Thread rabbiaqaswar
I did, three days back but got no reply from there: http://forum.hibernate.org/viewtopic.php?t=987845&highlight= View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4159267#4159267 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-19 Thread jaikiran
I would suggest posting in the Hibernate forums instead of filing a bug. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4159261#4159261 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4159261

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-19 Thread rabbiaqaswar
:) Thanks Should i report it as a bug at Hibernate? Maybe it is something wrong at their end? View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4159186#4159186 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4159186 __

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-18 Thread jaikiran
I am running out of ideas. The only other suggestion i can give you is to use the correct (perhaps the latest) JDBC driver of Oracle. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4159164#4159164 Reply to the post : http://www.jboss.com/index.html?module=bb&

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-17 Thread rabbiaqaswar
This property is already set in the persistence.xml file along with the batch size property which i mentioned earlier. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4158696#4158696 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mod

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-17 Thread jaikiran
I dont have a setup which has Oracle on it. I don't know why the query is getting generated incorrectly. Can you try adding the following property to your persistence.xml and see if it helps: | | | ... | | |

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-17 Thread rabbiaqaswar
It is Oracle 9i. Here is the datasource file: | | UserDS | | false | oracle.jdbc.xa.client.OracleXADataSource | jdbc:oracle:thin:@mach:1521:ORAUR | name | password | | | | org.jboss.resource.adapter.jdbc.vendor.OracleEx

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-17 Thread jaikiran
Which database server/version do you use? Can you post the datasource file that you have configured? View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4158667#4158667 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4158667

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-17 Thread rabbiaqaswar
Typo error in the previous post, for the first scenario, its: setfirstResult(0) and setMaxResults(10) View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4158631#4158631 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4158631

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-17 Thread rabbiaqaswar
Thanks. I enabled Trace and the two queries executed internally are actually different! Here is the query which is executed with the setfirstResult(0) and setMaxResults(20): select * from (SELECT DISTINCT USR.USERID FROM USER USR, USERWATCH UW WHERE USR.ADDEDBYID =1 AND | USR.COUNTRY = CAS

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-16 Thread jaikiran
I don't believe the jdbc batch size would affect your query output. For further logging options, see this http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#configuration-logging And yes, do look for the actual query being fired by Hibernate in the logs. Something similar to: 2008

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-16 Thread rabbiaqaswar
Do you think it has anything to do with the following property in persistence.xml file: Will try debugging through Trace. Thanks View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4158582#4158582 Reply to the post : http://www.jboss.com/index.html?module=bb&

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-16 Thread jaikiran
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 Hibe

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-15 Thread rabbiaqaswar
Anyone? I still cannot solve the issue :( View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4158190#4158190 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4158190 ___ jboss-user ma

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-13 Thread rabbiaqaswar
Following is the sql query: SELECT DISTINCT USR.USERID FROM USER USR, USERWATCH UW WHERE USR.ADDEDBYID =1 AND USR.COUNTRY = CASE WHEN (UW.COUNTRY is null) THEN USR.COUNTRY ELSE UW.COUNTRY END AND USR.ALIVE = 'A' View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-13 Thread jaikiran
Looking at the output, it looks like along with the ids, even the record count (ex: 11, 12, 13 etc) is being returned. Without looking at the actual query which you are using i can't say what the problem is. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-13 Thread rabbiaqaswar
Since the query was returning an Object array, i printed its contents if(ids != null && !ids .isEmpty()){ |for (Iterator it = ids.iterator(); it.hasNext();) { | | Object[] obj = (Object[])it.next(); | System.out.println(""+Arrays.deepToString(obj)); | |} | } and

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-13 Thread rabbiaqaswar
It is a SQL join query which returns primary keys of type BigDecimal of a database table. It workds fine without paging i.e. return 20 ids and when the first ten records are fetched using the setFirstResult & setMaxResults methods. The problem occurs when the first result is set to 10 and max

[jboss-user] [EJB 3.0] - Re: EntityManager's Native Query & Paging Results

2008-06-13 Thread jaikiran
What does your strQuery look like? View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157874#4157874 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4157874 ___ jboss-user mailing