java - Can not understand the result of request JPA -
i have function return arraylist< string > ,the list contain elements retrieved database using jpa ,my problem can't understand format of output!
the function is:
public arraylist<string> getmylistenvironment() { arraylist<string> env=new arraylist<string>(); try{ entitytransaction entr=em.gettransaction(); entr.begin(); javax.persistence.query multipleselect= em.createquery("select h.henv hpe h h.hpepk.peplatform = :w ").setparameter("w", "platf1"); list s = new linkedlist(); s= multipleselect.getresultlist(); env = new arraylist(s); entr.commit(); return env; } catch (exception e ) { system.out.println(e.getmessage()); system.out.println("error"); } { em.close(); } return env; }
the output(result):
[dtomonito.henv[ envurl=http://10.55.99.5:1055 ], dtomonito.henv[ envurl=http://10.55.99.99:8090 ]]
the query returning list of henv
found fields of the hpe
entity (seems these abbreviations entities cause more confusion - it's idea use descriptive names these type of things).
is hpe.henv
string? perhaps output confusing because storing formatted string in field. without seeing code, hard decipher.
btw, method bit wasteful creating dead stores. there absolutely no point in writing this:
list s = new linkedlist(); s= multipleselect.getresultlist();
you save line of code (and linkedlist allocation) writing
list s = multipleselect.getresultlist();
Comments
Post a Comment