java - Get id from json file without Generate an automatical value -
i have json file parse contain id value, example:
{ "test": [ { "id": "14", ... } ] }
in java class (i'm using spring mvc) have :
@id private integer id;
when import json database, changes id value. need same id in json file (in case 14) in db generate value (i didn't use @generatedvalue(strategy= generationtype.auto)
in java class).
my controller:
in java read id this:
@autowired testservice testservice; string id = (string)qobj.get("id"); int idq = integer.parseint(id); test.setid(idq); testservice.save(test);
service:
@override public test save(test q) { return repository.save(q); }
could tell me why changes id value? if did not specify generatedvalue
annotation? , if have idea solve it?
i've found error, works now.
Comments
Post a Comment