java - empty collection when it should be populated -
a controller in spring mvc app giving empty concepts collection drugword entity when there drugconcepts in database every drugword. how can change code populates concepts collection appropriate number of drugconcept instances each drugword instance?
here jpa code queries database:
@suppresswarnings("unchecked") public drugword finddrugword(string wrd) { system.out.println("..... wrd is: "+wrd); return (drugword) em.find(drugword.class, wrd); } here code relevant controller method, prints out 0 size of sel_word.getconcepts().size() when size should @ least 1:
@requestmapping(value = "/medications", method = requestmethod.get) public string processfindform(@requestparam(value="wordid", required=false) string word, patient patient, bindingresult result, map<string, object> model) { collection<drugword> results = this.clinicservice.finddrugwordbyname(""); system.out.println("........... word is: "+word); if(word==null){word="abacavir";} model.put("words", results); drugword sel_word = this.clinicservice.finddrugword(word); system.out.println(";;;; sel_word.concepts.size(), sel_word.getname() are: "+sel_word.getconcepts().size()+", "+sel_word.getname()); model.put("sel_word", sel_word); return "medications/medslist"; } is problem have programmed? problem solved if had put method? if so, put method need like?
note: keep posting brief, have uploaded relevant code file sharing site. can view code clicking on following links:
code drugword entity at link.
code drugconcept entity at link.
code drugatom entity at link.
code create underlying data tables in mysql at link.
code populate underlying data tables is @ link.
data 1 of tables is @ link.
representative data second table at link.(this 10,000 records table, has perhaps 100,000 rows.)
data third table is @ link. (this big file, may take few moments load.)
persistence xml file can read at link.
to people visualize underlying data, including print screen of top 2 results of queries showing data in underlying tables follows:

the problem seemed db corrupt, had new lines characters in every word, queries returned empty result. besides there problems big graphs of entities loaded db, triggering lot of sql queries.
Comments
Post a Comment