-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 
Author Message
 Post subject: setFirstResult(pStartRow) problème
PostPosted: Mon May 30, 2005 8:48 am 
Regular
Regular

Joined: Mon Apr 25, 2005 5:36 am
Posts: 103
salut
j'ai un pb avec ce code:

List list = sess.createQuery(query)
.setFirstResult(pStartRow)
.setMaxResults(pFetchSize)
.list();


Ma requête "query" est une requete simple qui fonctionne TB lorsque je met pStrartRow à 0 mais quand je mets une autre valeur, 2 par exemple, j'ai une erreur




14:43:09,403 DEBUG SQL:310 - select * from ( select row_.*, rownum rownum_ from ( select departemen0_.ID_DEPARTEMENT as ID1_, departemen0_.version as version0_, departemen0_.COD_DEPARTEMENT as COD3_0_, departemen0_.LIBL_DEPARTEMENT as LIBL4_0_, departemen0_.LIBC_DEPARTEMENT as LIBC5_0_, departemen0_.BLN_ACTIF as BLN6_0_, departemen0_.DAT_MODIF as DAT7_0_, departemen0_.ID_UTILISATEUR_MODIF as ID8_0_ from HIBERNATE.DEPARTEMENT departemen0_ where (COD_DEPARTEMENT=11 and BLN_ACTIF=1) ) row_ ) where rownum_ <= ? and rownum_ > ?
Hibernate: select * from ( select row_.*, rownum rownum_ from ( select departemen0_.ID_DEPARTEMENT as ID1_, departemen0_.version as version0_, departemen0_.COD_DEPARTEMENT as COD3_0_, departemen0_.LIBL_DEPARTEMENT as LIBL4_0_, departemen0_.LIBC_DEPARTEMENT as LIBC5_0_, departemen0_.BLN_ACTIF as BLN6_0_, departemen0_.DAT_MODIF as DAT7_0_, departemen0_.ID_UTILISATEUR_MODIF as ID8_0_ from HIBERNATE.DEPARTEMENT departemen0_ where (COD_DEPARTEMENT=11 and BLN_ACTIF=1) ) row_ ) where rownum_ <= ? and rownum_ > ?
14:43:09,413 DEBUG AbstractBatcher:364 - preparing statement
14:43:09,674 DEBUG AbstractBatcher:284 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
14:43:09,674 DEBUG AbstractBatcher:392 - closing statement
14:43:09,694 DEBUG JDBCExceptionReporter:49 - could not execute query [select departemen0_.ID_DEPARTEMENT as ID1_, departemen0_.version as version0_, departemen0_.COD_DEPARTEMENT as COD3_0_, departemen0_.LIBL_DEPARTEMENT as LIBL4_0_, departemen0_.LIBC_DEPARTEMENT as LIBC5_0_, departemen0_.BLN_ACTIF as BLN6_0_, departemen0_.DAT_MODIF as DAT7_0_, departemen0_.ID_UTILISATEUR_MODIF as ID8_0_ from HIBERNATE.DEPARTEMENT departemen0_ where (COD_DEPARTEMENT=11 and BLN_ACTIF=1)]
java.sql.SQLException: ORA-01722: Nombre non valide

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
at oracle.jdbc.ttc7.TTC7Protocol.fetch(TTC7Protocol.java:889)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:1681)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1870)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:314)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:118)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1197)
at org.hibernate.loader.Loader.doQuery(Loader.java:366)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:206)
at org.hibernate.loader.Loader.doList(Loader.java:1515)
at org.hibernate.loader.Loader.list(Loader.java:1498)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:369)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:268)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:788)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at fr.icdc.dei.fwk.sample.persistance.service.impl.DepartementDAOImpl.findDepartementByCriteria(DepartementDAOImpl.java:169)
at fr.icdc.dei.fwk.test.Test.main(Test.java:57)
14:43:09,704 WARN JDBCExceptionReporter:57 - SQL Error: 1722, SQLState: 42000
14:43:09,714 ERROR JDBCExceptionReporter:58 - ORA-01722: Nombre non valide


J'ai comme l'impression que la fonction qui gère FirstResult ne fonctionne pas bien. Est-ce que qqn voit mon problème? Aidez moi !!!


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 31, 2005 2:19 am 
Regular
Regular

Joined: Tue May 03, 2005 8:19 am
Posts: 53
Location: Paris
J'imagine que tu as testé la requête suivante avec tes valeurs (0, 2, ...) :
Code:
select * from ( select row_.*, rownum rownum_ from ( select departemen0_.ID_DEPARTEMENT as ID1_, departemen0_.version as version0_, departemen0_.COD_DEPARTEMENT as COD3_0_, departemen0_.LIBL_DEPARTEMENT as LIBL4_0_, departemen0_.LIBC_DEPARTEMENT as LIBC5_0_, departemen0_.BLN_ACTIF as BLN6_0_, departemen0_.DAT_MODIF as DAT7_0_, departemen0_.ID_UTILISATEUR_MODIF as ID8_0_ from HIBERNATE.DEPARTEMENT departemen0_ where (COD_DEPARTEMENT=11 and BLN_ACTIF=1) ) row_ ) where rownum_ <= ? and rownum_ > ?


Si elle fonctionne, alors les seuls nombres qu'Oracle ne peut pas convertir sont rownum_ <= ? and rownum_ > ?, il faut donc que tu nous donnes des pistes :

Quelle est la version d'hibernate ?
Quelle est la version du driver JDBC ?
Quel JDK?
Quel Dialect dans ton fichier de configuration?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 31, 2005 4:39 am 
Regular
Regular

Joined: Mon Apr 25, 2005 5:36 am
Posts: 103
lauvigne wrote:
J'imagine que tu as testé la requête suivante avec tes valeurs (0, 2, ...) :
Code:
select * from ( select row_.*, rownum rownum_ from ( select departemen0_.ID_DEPARTEMENT as ID1_, departemen0_.version as version0_, departemen0_.COD_DEPARTEMENT as COD3_0_, departemen0_.LIBL_DEPARTEMENT as LIBL4_0_, departemen0_.LIBC_DEPARTEMENT as LIBC5_0_, departemen0_.BLN_ACTIF as BLN6_0_, departemen0_.DAT_MODIF as DAT7_0_, departemen0_.ID_UTILISATEUR_MODIF as ID8_0_ from HIBERNATE.DEPARTEMENT departemen0_ where (COD_DEPARTEMENT=11 and BLN_ACTIF=1) ) row_ ) where rownum_ <= ? and rownum_ > ?


Si elle fonctionne, alors les seuls nombres qu'Oracle ne peut pas convertir sont rownum_ <= ? and rownum_ > ?, il faut donc que tu nous donnes des pistes :

Quelle est la version d'hibernate ?
Quelle est la version du driver JDBC ?
Quel JDK?
Quel Dialect dans ton fichier de configuration?




C'est bon, il me manquait des guillemets, Maintenant çà marche. C'est bizarre hibernate


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 31, 2005 5:21 am 
Regular
Regular

Joined: Tue May 03, 2005 8:19 am
Posts: 53
Location: Paris
julientarrago wrote:
C'est bon, il me manquait des guillemets, Maintenant çà marche. C'est bizarre hibernate


Ou il te manquait des guillemets ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 31, 2005 5:26 am 
Regular
Regular

Joined: Mon Apr 25, 2005 5:36 am
Posts: 103
lauvigne wrote:
julientarrago wrote:
C'est bon, il me manquait des guillemets, Maintenant çà marche. C'est bizarre hibernate


Ou il te manquait des guillemets ?



Dans ma requête.

from XXX where truc = 'qqch' AND chose = 'lol'

avant je faisais çà :

from XXX where truc = qqch AND chose = lol


Top
 Profile  
 
 Post subject: setFirstResult(pStartRow) problème
PostPosted: Mon Jun 13, 2005 3:04 am 
Newbie

Joined: Fri Jun 10, 2005 12:25 pm
Posts: 6
I gone through entire discussion and got converted it into English from one of my friend. I am facing the same problem/exception and I have not missed any double quotes, I am not sure why am I getting same exception.
I am using Hibernet 3.0
I am using Oracle9
Dialect is org.hibernate.dialect.Oracle9Dialect
JDK: 1.4.02

Help is appreciated
Thanks
Sunil


Top
 Profile  
 
 Post subject: Re: setFirstResult(pStartRow) problème
PostPosted: Tue Jun 14, 2005 4:34 am 
Regular
Regular

Joined: Mon Apr 25, 2005 5:36 am
Posts: 103
sunil_chandurkar wrote:
I gone through entire discussion and got converted it into English from one of my friend. I am facing the same problem/exception and I have not missed any double quotes, I am not sure why am I getting same exception.
I am using Hibernet 3.0
I am using Oracle9
Dialect is org.hibernate.dialect.Oracle9Dialect
JDK: 1.4.02

Help is appreciated
Thanks
Sunil


I have done some test with the HQL view editor, and I see my errors, it is the only help I can give you.



give me your errors, if I can help you....


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 14, 2005 4:43 am 
Newbie

Joined: Fri Jun 10, 2005 12:25 pm
Posts: 6
Thanks for the help. It is resolved now. Problem was somewhere else and was looking into something else.
Thanks again !
Sunil


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.