Deserialization of the wrong json on the date of the object on the java server

Asked

Viewed 48 times

2

I have a User object and it contains the dataDeascimento attribute, I pass the user object to the server, the date I provide in the following format 2017-12-31, but the server changes to 2017-12-30, always decreases one day on the date

server

@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Path("/")
public Response store(Usuario usuario) {
    try {
        if(dao(this).existeEmail(usuario.getEmail())) {
            return erro("Email já existe!");
        }

        dao(this).save(usuario);

        return responseOk(usuario);

    }catch (Exception e) {
        return erroInterno(e);
    }
}

User Model

@Entity
class Usuario {
    @Temporal(TemporalType.DATE)
    private Date dataDeNascimento;
 }
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.