Hibernate. how to read query results not mapped? -
im new in hibernate , java, , there dont understand how solve.(im trying mod existing code)
i have table called ct0016582213 has mapping file: track.hbm.xml , entity class: track.class
until here normal, when query extract values inside table can read values inside tables hibernate mapping.
but problem i'm trying custom sql queries , want read resulting table values got [ljava.lang.object;@15df563 instead real value.
//part of code session = hibernateutils.getsession(); session.begintransaction(); string mql= "select date_format(createtime,'%y-%m-%d') fecha, format((max(mileage)- min(mileage)),1) kilom ct0016582213 createtime between '2015-06-02%' , '2015-06-30%' group date_format(createtime,'%y-%m-%d')"; sqlquery query1 = session.createsqlquery(mql); list kilom = query1.list(); str=str + "<item>"+ kilom.get(0)+"</item>"; str=str + "<item>"+ kilom.get(1)+"</item>"; session.gettransaction().commit(); response.setcharacterencoding("utf-8"); response.setcontenttype("text/xml"); out.write(str);
this give 2 columns result when want show values shows instead [ljava.lang.object;@15df563.
and im confused because if query has 1 column result can read , show real values inside resulting query, example if use next sql query can read example 2015-06-05 result.
string mql= "select date_format(createtime,'%y-%m-%d') fecha ct0016582213 createtime between '2015-06-02%' , '2015-06-30%' group date_format(createtime,'%y-%m-%d')";
how should read values in resulting table when there more 1 column value , not object?
can avoid mapping? if not..how map table result of query? how can read values
did explanined problem?, :-) help
Comments
Post a Comment