javax - query.list() Exception java.lang.Integer cannot be cast to java.lang.String -
i encounter error when i'm in javax queries far have not encountered such error , not know why
@post @path("/aa") @consumes(mediatype.application_json) public response polaki(user user, @headerparam("authorization") string authstring, @headerparam("api_key") string apikey) throws exception { if (authstring.equals(usersetting.authorization) & apikey.equals(usersetting.api_key)) { tx = session.gettransaction(); tx.begin(); query query = session.createquery("from service service=:service"); query.setparameter("service", user.getservice()); tx.commit(); list ls= query.list(); // eror return response.status(200).entity("{\"message\":\"service eror\"}").build(); } else { return response.status(200).entity("{\"message\":\"service eror\"}").build(); } }
exception java.lang.integer cannot cast java.lang.string
what user.getservice()
return? integer?
try example , see happens:
query.setparameter("service", string.valueof(user.getservice()));
service
varchar (string-ish) in database.
Comments
Post a Comment