Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
AW: AW: [eclipselink-users] NumberFormatException at setting id value

Hello Chris,
thanks for the "L" hint, this should keep away some trouble.

The stacktrace for a query like this:
"select this from Something this where this.id in (-1)"
Regards, Markus

##########################################
java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: 
Exception Description: Syntax error parsing the query [SELECT OBJECT(this)  FROM ItemEffort this WHERE this.id in (-1)], line 1, column 60: unexpected token [-].
Internal Exception: NoViableAltException(90!=[700:9: (itemNode= inItem ( COMMA itemNode= inItem )* | subqueryNode= subquery )])
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1241)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:198)
	at $Proxy6.createQuery(Unknown Source)
	at com.ottogroup.buying.sharedkernel.base.jpa.ReproduceBug294289IT.testByJPQLQuery(ReproduceBug294289IT.java:66)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at junit.framework.TestSuite.runTest(TestSuite.java:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: Exception [EclipseLink-8025] (Eclipse Persistence Services - 1.2.1.v20100114-r6267): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Syntax error parsing the query [SELECT OBJECT(this)  FROM ItemEffort this WHERE this.id in (-1)], line 1, column 60: unexpected token [-].
Internal Exception: NoViableAltException(90!=[700:9: (itemNode= inItem ( COMMA itemNode= inItem )* | subqueryNode= subquery )])
	at org.eclipse.persistence.exceptions.JPQLException.unexpectedToken(JPQLException.java:372)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.handleRecognitionException(JPQLParser.java:319)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.addError(JPQLParser.java:245)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.reportError(JPQLParser.java:362)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.inExpression(JPQLParser.java:8209)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.conditionWithNotExpression(JPQLParser.java:7879)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.simpleConditionalExpressionRemainder(JPQLParser.java:7750)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.simpleConditionalExpression(JPQLParser.java:7625)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.conditionalPrimary(JPQLParser.java:7561)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.conditionalFactor(JPQLParser.java:4507)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.conditionalTerm(JPQLParser.java:4397)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.conditionalExpression(JPQLParser.java:4323)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.whereClause(JPQLParser.java:4280)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.selectStatement(JPQLParser.java:371)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.document(JPQLParser.java:276)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.parse(JPQLParser.java:133)
	at org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.buildParseTree(JPQLParser.java:94)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:166)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:141)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:93)
	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:77)
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1239)
	... 25 more
Caused by: NoViableAltException(90!=[700:9: (itemNode= inItem ( COMMA itemNode= inItem )* | subqueryNode= subquery )])
	at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.inExpression(JPQLParser.java:8125)
	... 42 more
##########################################


-----Ursprüngliche Nachricht-----
Von: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx] Im Auftrag von christopher delahunt
Gesendet: Montag, 8. Februar 2010 18:58
An: EclipseLink User Discussions
Betreff: Re: AW: [eclipselink-users] NumberFormatException at setting id value

Hello Markus,

If your type is a Long, you will need to specify the suffix as "id = 
1234455656565l", otherwise all literals get converted to Integer by 
default.

For bug 294289, can you be sure to post the exception you are getting 
when you use a negative number?

Best Regards,
Chris Delahunt


Hahn, Markus wrote:
>
> Hi Shaun,
>
> our datatype is Long, so this should be big enough for this number.
>
> I found out some more details, and I think we ran into a problem 
> similar to a known bug we logged in November (id 294289) referring to 
> queries with negative or big numbers.
>
> There the bug is described for negative and big numbers in IN clauses, 
> but it looks like we have to "enhance" the bug also on simple "id = 
> 1234455656565" cases.
>
> In our current issue it helps to use named parameters, as described in 
> the logged bug.
>
> I suppose it makes sense to give a higher priority to this bug, I 
> added my comment and my vote.
>
> Regards, Markus
>
> Stacktrace:
>
> [EL Fine]: 2010-02-08 
> 13:10:19.203--ClientSession(1716384)--Connection(19182761)--SELECT 
> BUYING.SEQ_CHANGETRACKINGLOGENTR
>
> XTVAL FROM DUAL
>
> WARN [main] (Log4jLogger.java:91) - invoke failed with exception of 
> class org.springframework.aop.framework.ReflectiveMe
>
> Invocation#public abstract java.lang.Object 
> com.ottogroup.buying.sharedkernel.base.Crud.attach(com.ottogroup.buying.share
>
> nel.base.QueryConfiguration,java.lang.Object) with 
> [QueryConfiguration(attach, fetchPlan:), ChangeTrackingLogEntry(null)]
>
> rew
>
> java.lang.IllegalArgumentException: An exception occurred while 
> creating a query in EntityManager:
>
> Exception Description: General Problem parsing the query [SELECT 
> OBJECT(this) FROM ChangeTrackingLogEntry this WHERE ((
>
> .id = 2640429949))]. The parser returned the following [For input 
> string: "2640429949"].
>
> Internal Exception: java.lang.NumberFormatException: For input string: 
> "2640429949"
>
> at 
> org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1241)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:585)
>
> at 
> org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntit
>
> agerCreator.java:198)
>
> at $Proxy7.createQuery(Unknown Source)
>
> at 
> com.ottogroup.buying.sharedkernel.base.eclipselink.EclipselinkJpaQuery.buildQuery(EclipselinkJpaQuery.java:530
>
> at 
> com.ottogroup.buying.sharedkernel.base.eclipselink.EclipselinkJpaQuery.execute(EclipselinkJpaQuery.java:428)
>
> at 
> com.ottogroup.buying.sharedkernel.base.AbstractDaoImpl.reloadEntity(AbstractDaoImpl.java:777)
>
> at 
> com.ottogroup.buying.sharedkernel.base.AbstractDaoImpl.typeAttach(AbstractDaoImpl.java:748)
>
> at 
> com.ottogroup.buying.sharedkernel.base.AbstractDaoImpl.attach(AbstractDaoImpl.java:307)
>
> at 
> com.ottogroup.buying.sharedkernel.base.AbstractDaoImpl.attach(AbstractDaoImpl.java:51)
>
> at 
> com.ottogroup.buying.sharedkernel.base.BaseRepository.attach(BaseRepository.java:141)
>
> at 
> com.ottogroup.buying.sharedkernel.base.BaseRepository.attach(BaseRepository.java:23)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:585)
>
> at 
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
>
> at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:1
>
> at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
>
> at 
> com.ottogroup.buying.sharedkernel.base.error.AopMessageHandler.invoke(AopMessageHandler.java:38)
>
> at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>
> at 
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
>
> at 
> com.ottogroup.buying.sharedkernel.base.error.CustomTransactionInterceptor.invoke(CustomTransactionInterceptor.
>
> :81)
>
> at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
>
> at 
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>
> at $Proxy195.attach(Unknown Source)
>
> at 
> com.ottogroup.buying.sharedkernel.masterdatachange.ChangeTracker.storeChangeTrackingLogEntries(ChangeTracker.j
>
> 307)
>
> at 
> com.ottogroup.buying.sharedkernel.masterdatachange.ChangeTracker.trackChanges(ChangeTracker.java:177)
>
> at 
> com.ottogroup.buying.sharedkernel.base.eclipselink.PreCommitUnitOfWorkListener.preCommitUnitOfWork(PreCommitUn
>
> WorkListener.java:47)
>
> at 
> org.eclipse.persistence.sessions.SessionEventManager.preCommitUnitOfWork(SessionEventManager.java:531)
>
> at 
> org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commit(UnitOfWorkImpl.java:1064)
>
> at 
> org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.ja
>
> 7)
>
> at 
> org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:63)
>
> at 
> org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:456)
>
> at 
> org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTrans
>
> onManager.java:732)
>
> at 
> org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionM
>
> er.java:701)
>
> at 
> org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
>
> at 
> com.ottogroup.buying.sharedkernel.base.it.Environment$1.execute(Environment.java:73)
>
> at 
> com.ottogroup.buying.sharedkernel.base.it.AbstractIntegrationTestCase.executeTransactioned(AbstractIntegration
>
> Case.java:465)
>
> at 
> com.ottogroup.buying.sharedkernel.item.itemeffort.RedPriceIT.testAddRedPrice(RedPriceIT.java:38)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:585)
>
> at junit.framework.TestCase.runTest(TestCase.java:154)
>
> at junit.framework.TestCase.runBare(TestCase.java:127)
>
> at junit.framework.TestResult$1.protect(TestResult.java:106)
>
> at junit.framework.TestResult.runProtected(TestResult.java:124)
>
> at junit.framework.TestResult.run(TestResult.java:109)
>
> at junit.framework.TestCase.run(TestCase.java:118)
>
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
>
> at junit.framework.TestSuite.run(TestSuite.java:203)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:585)
>
> at 
> org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213)
>
> at 
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
>
> at 
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
>
> at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:585)
>
> at 
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
>
> at 
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
>
> Caused by: Exception [EclipseLink-8002] (Eclipse Persistence Services 
> - 1.2.1.v20100114-r6267): org.eclipse.persistence.e
>
> tions.JPQLException
>
> Exception Description: General Problem parsing the query [SELECT 
> OBJECT(this) FROM ChangeTrackingLogEntry this WHERE ((
>
> .id = 2640429949))]. The parser returned the following [For input 
> string: "2640429949"].
>
> Internal Exception: java.lang.NumberFormatException: For input string: 
> "2640429949"
>
> at 
> org.eclipse.persistence.exceptions.JPQLException.generalParsingException(JPQLException.java:123)
>
> at 
> org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.addError(JPQLParser.java:247)
>
> at 
> org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.parse(JPQLParser.java:135)
>
> at 
> org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.buildParseTree(JPQLParser.java:94)
>
> at 
> org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:166)
>
> at 
> org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:141)
>
> at 
> org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:93)
>
> at 
> org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:77)
>
> at 
> org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1239)
>
> ... 68 more
>
> Caused by: java.lang.NumberFormatException: For input string: "2640429949"
>
> at 
> java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
>
> at java.lang.Integer.parseInt(Integer.java:459)
>
> at java.lang.Integer.valueOf(Integer.java:553)
>
> at 
> org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.literalNumeric(JPQLParser.java:11001)
>
> at 
> org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.arithmeticPrimary(JPQLParser.java:9536)
>
> at 
> org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.arithmeticFactor(JPQLParser.java:9349)
>
> *Von:* eclipselink-users-bounces@xxxxxxxxxxx 
> [mailto:eclipselink-users-bounces@xxxxxxxxxxx] *Im Auftrag von *Shaun 
> Smith
> *Gesendet:* Freitag, 5. Februar 2010 20:38
> *An:* eclipselink-users@xxxxxxxxxxx
> *Betreff:* Re: [eclipselink-users] NumberFormatException at setting id 
> value
>
> Hi Markus,
>
> Can you post a stack trace and can you describe the situation a little 
> more? If you have typed an id field as int or Integer and your 
> sequence generates a value > MAXINT I suspect you'll get 
> NumberFormatException when EclipseLink tries to parse that value into 
> an Integer. If you want to have ids larger than MAXINT then you need a 
> data type that can hold it.
>
> Shaun
>
> On 4/2/2010 11:50 AM, Hahn, Markus wrote:
>
> Hello,
>
> are there any known issues with big numbers? In a persist operation, 
> we fill an ID from a sequence. Value ist for instance 2320149544, thus 
> out of Integer scope.
>
> EL runs into a NumberFormatException parsing this number as an Integer.
>
> What can I do to avoid this? Change the mapping (almost only defaults)?
>
> Regards, Markus
>
>  
>  
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx <mailto:eclipselink-users@xxxxxxxxxxx>
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>   
>
> -- 
> Oracle <http://www.oracle.com>
> Shaun Smith | Principal Product Manager
> Phone: +19055023094
> Oracle Server Technologies, Oracle TopLink
> ORACLE Canada | 110 Matheson Boulevard West, Suite 100, Mississauga, 
> Ontario | L5R 3P4
> Green Oracle <http://www.oracle.com/commitment>Oracle is committed to 
> developing practices and products that help protect the environment
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>   
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top