[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] NumberFormat exception when searching for numeric fields
|
mgsoft,
good use case. One alternate option could be to store the field as
a String/VARCHAR on the database and use an EclipseLink native
@TypeConverter - so we could use it as numeric field like a Long,
Integer or BigInteger when in JPA.
Here is a example of this case where we needed to get around the
10^19 or 2^63 size limitation of the NUMERIC field imposed on unbounded
BigInteger objects by all databases by using a TypeConverter.
http://wiki.eclipse.org/EclipseLink/Examples/Distributed#DI_5:_Limitations_of_BigInteger_translation_to_BIGINT_Database_DataType
@Entity
@TypeConverters({@TypeConverter(name="BigIntegerToString",dataType=String.class,objectType=BigInteger.class)})
public class Parametersimplements Serializable {
@Column(name="maxValue", nullable=false, length=512)
@Convert("BigIntegerToString")
private BigInteger maxValue;
One of the clients of this distributed app also uses a brute force
ajax client.
thank you
/michael
On 2011-04-02 04:19, mgsoft wrote:
I have got a webapplication that contains an AJAX-driven autocomplete field
that is mapped to a numeric field of type long.
As soon as the user enters at least two characters an AJAX-request is sent
to the server that in turn should query the database in order to fetch a
list of possible items.
The query is very simple:
select a.id from Material a where a.id like '12%'
But that query doesn't work! I get an EclipseLink conversion exception that
is
Caused by: java.lang.NumberFormatException: For input string: "12%"
Please tell me how to use wildcards when searching for numeric fields! Thank
you very much.