1
I am testing the play-framework 2.4.3 and I coded below to update the template I receive via json, but only the update is not working. I have the query log enabled but only a select appears for this action. I am using the H2 database. What is missing ?
//Imports do controller
import play.*;
import play.mvc.*;
import play.libs.*;
import views.html.*;
import java.util.*;
import models.*;
//Código da action
Estado estadoParametro = Json.fromJson(request().body().asJson(), Estado.class);
Estado estado = Estado.find.byId(id);
estado.nome = estadoParametro.nome;
estado.update();
Strange, because theoretically it was supposed to work. In this case you have to analyze everything, like your State Model, check if the id that this really exists. Do a simple test on the same hand, like: Status = Status.find.byId(1); //Must be an existing id status.name = "Anything"; status.update();
– Alfaville
I solved this problem by creating a new project and moving the controllers and templates to the new project. Stopped giving trouble. Weird.
– ILDYONE