Issue
I'm trying to update "Estab", which are entities with Latitude (locLat) and Longitude (locLon). I'm having difficulties to update them, because it will not always set the values and I can't find a pattern.
{
"estabId": 4,
"nombre": "Palacio de las Artes Reina Sofia Modificado",
"direccion": "Avda. Profesor Lopez PiƱero",
"codPost": 46010,
"poblacion": "Valencia",
"telefono": "963219874",
"url": "www.palaudelesarts.com",
"locLat": 52.2,
"locLon": -6554,
"locZoom": 1,
"tipo": 3
}
Above, is what I send to the entity, and then it's supposed to set the values. At first I thought there would be an issue with integer numbers, so I created 2 setters for each attribute (Lat and Lon). Minutes ago, I even created a 3rd setter to be able to pass values as String in case it worked:
@Column(name="loc_lat")
private Double locLat;
public void setLocLat(double locLat) {
this.locLat = locLat;
}
public void setLocLat(int lat) {
String latStr = String.valueOf(lat);
double latD = Double.valueOf(latStr);
this.locLat = latD;
}
public void setLocLat(String lat) {
double latD = Double.valueOf(lat);
this.locLat = latD;
}
Another fact that feels so weird to me is that when I run program in debug mode, it actually seems to work, no matter what of the 3 methods is used.
I tried to change the value type on the variable "latD" from "Double" to "double" and it seemed to work for a couple tries, but not anymore.
Does anyone have an idea of what is going on here? Thank you so much in advance!!
Btw, I'm sending all the info through Postman.
Solution
SOLUTION:
Working with Double gave me some issues in the past, so I finally decided to save all Double values as Strings in my databases. At any time, I just take the numeric value and operate with it with no issues.
Answered By - Calfa