Re: Select on Double value during saveChanges
Re: Select on Double value during saveChanges
- Subject: Re: Select on Double value during saveChanges
- From: Markus Ruggiero <email@hidden>
- Date: Sun, 02 Feb 2014 17:38:08 +0100
Am 01.02.2014 um 14:19 schrieb Jeffrey Schmitz < email@hidden>: Hello List,
I have an operation that updates many attributes on about 150 rows of data in a TeamInfo table. When doing a saveChanges operation it generates a SELECT statement like the one shown below for about 50 of the rows before it hits the one shown below that raises an exception. All the previous SELECT's find a single row, but this particular one finds none.
The reason it's not finding a row is because of the value it's generating for finding a Double typed value. For some reason it's using 72.60000000000001 but the value in the database is showing 72.6 (see bottom image). I went through the debugger and stopped to the line where the value is set, and it is setting it to 72.6 (see image below).
Sounds like some kind of nasty rounding/floating point representation problem going on so I'm wondering what I could do to guard against this?
Switch to BigDecimal. Do not use floating point values with equality checks.
or remove the little lock from the column in Entity Modeler. This lock tells the framework to include the attribute in the where-clause.
---markus---
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden