Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » JPQL Bug? BigInteger 22 digits (precision=22, scale=0)(I'm trying to run a query with a field bigInteger with 22 digits)
JPQL Bug? BigInteger 22 digits (precision=22, scale=0) [message #979372] Sat, 10 November 2012 21:44 Go to next message
FiruzzZ Mising name is currently offline FiruzzZ Mising nameFriend
Messages: 19
Registered: October 2011
Junior Member
I tried with and without the "L" at the end of the value of numero, but is not working.
PD: This query runs well on PostgreSQL.

    @Basic(optional = false)
    @Column(name = "numero", nullable = false, precision = 22, scale = 0)
    private BigInteger numero;

25450 (2012/11/10 18:34:42,586) ERROR controller.CuentabancariaController - java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: General Problem parsing the query [SELECT o FROM CuentaBancaria o WHERE o.numero=2222444433335555666602L].
The parser returned the following [For input string: "2222444433335555666602"].
Internal Exception: java.lang.NumberFormatException: For input string: "2222444433335555666602"
Re: JPQL Bug? BigInteger 22 digits (precision=22, scale=0) [message #981746 is a reply to message #979372] Mon, 12 November 2012 17:04 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1294
Registered: July 2009
Senior Member
2222444433335555666602 is too big for a long in Java, which has a maximum value of 9223372036854775807.

You will need to create the BigDecimal yourself and pass it as a parameter to the query:
em.createQuery("SELECT o FROM CuentaBancaria o WHERE o.numero=?1).setParameter(1, new BigInteger("2222444433335555666602")).getResultList();

Best Regards,
Previous Topic:Weird cache thread started
Next Topic:Eclipse link multiple SQL web services operations
Goto Forum:

Current Time: Thu Apr 19 15:55:13 GMT 2018

Powered by FUDForum. Page generated in 0.01313 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software