-->
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.  [ 4 posts ] 
Author Message
 Post subject: org.hibernate.hql.ast.ErrorCounter , unexpected token
PostPosted: Wed Jul 12, 2006 4:19 pm 
Newbie

Joined: Mon Jul 11, 2005 8:34 am
Posts: 12
I have a hql query which works perfectly for everything except for one specific sutuation, which in my view doesn't differ from the others. And I don't know why this is happening.

I have a WHILE doing some retrieving inside it, the first pass goes ok, then the next one gives the error, I debuged and this happens right when I call session.createQuery, and I'm positive the query is correct as you can see on the log below. I've googled all over but no joy! please help!

Why would the second time createQuery is called, get an error? It's the exact same thing it did the first time in the loop, and the parameters passed are ok I'm sure. The first SELECT works fine, and the second one should do the same thing.

Code:
Hibernate: select candidatov0_.num_inscricao as num1_, candidatov0_.txt_nome as txt2_15_, candidatov0_.data_nasc as data3_15_, candidatov0_.num_cpf as num4_15_, candidatov0_.num_identidade as num5_15_, candidatov0_.txt_sexo as txt6_15_, candidatov0_.txt_email as txt7_15_, candidatov0_.txt_endereco as txt8_15_, candidatov0_.txt_bairro as txt9_15_, candidatov0_.txt_cidade as txt10_15_, candidatov0_.txt_uf as txt11_15_, candidatov0_.txt_cep as txt12_15_, candidatov0_.txt_telefone as txt13_15_, candidatov0_.txt_telefone2 as txt14_15_, candidatov0_.num_concurso as num15_15_, candidatov0_.num_cargo as num16_15_, candidatov0_.num_area as num17_15_, candidatov0_.num_subarea as num18_15_, candidatov0_.num_unidade as num19_15_, candidatov0_.num_deficiente as num20_15_, candidatov0_.num_classificacao as num21_15_, candidatov0_.num_chamado as num22_15_, candidatov0_.nota_objetiva as nota23_15_, candidatov0_.nota_pratica as nota24_15_, candidatov0_.nota_final as nota25_15_, candidatov0_.num_edHomologa as num26_15_ from smp.candidato candidatov0_ where candidatov0_.num_inscricao=4027787 and candidatov0_.num_cpf=45633754387
[*] 2006-07-12 16:44:15,937|ERROR|org.hibernate.hql.ast.ErrorCounter|*** ERROR: line 1:75: unexpected token: 93469645
org.hibernate.hql.ast.QuerySyntaxError: unexpected token: 93469645 near line 1, column 75 [from br.gov.embrapa.smp.vo.CandidatoVO where id = 4014650 and numCpf = 02793469645]
   at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:63)
   at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:215)
   at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:127)
   at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
   at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
   at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:884)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:834)
   at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 12, 2006 5:24 pm 
Senior
Senior

Joined: Sun Jun 04, 2006 1:58 am
Posts: 136
try disabling the query cache

_________________
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 12, 2006 6:25 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Don't you find it intriguing though that your query lists the value [02793469645], while the exception complains about [93469645]...

02793469645 is to large for a integral literal. You need to explicitly specify this as a double: 02793469645d / 02793469645D

Or, use parameters...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 13, 2006 9:12 am 
Newbie

Joined: Mon Jul 11, 2005 8:34 am
Posts: 12
I'm so dumb!!! The field with the large number is a varchar in the table, and I was treating it as if it was a INT! All I had to do was pass it with quotes like this, '999999999' instead of 9999999999. I wish Hibernate would somehow display a better error message related to this!

But I still don't get why it worked fine on the first query, and only throw the error the second time it tried to retrieve! Anyway, thanks a million Steve for opening my eyes about the number!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.