when execute code, solution. need convert list readable format. dao code is
public list<data> getdata() { // todo auto-generated method stub system.out.println("in getdata dao************"); session=sessionfactory.opensession(); tx=session.begintransaction(); list<data> blist=session.createcriteria(>.class).list(); system.out.println("datalist dao************"+blist); tx.commit(); session.close(); return blist; }
data.java
@entity @table(name="tbl_genere") public class data implements serializable{ private static final long serialversionuid = 1l; @id @column(name="dataid") private string dataid; @column(name="dataname") private string dataname; public string getdataid() { return dataid; } public void setdataid(string dataid) { dataid = dataid; } public string getdataname() { return dataname; } public void setdataname(string dataname) { dataname = dataname; }
}
i solution, it's in unreadable format. how can convert readable format? answer dao************[com.pack.web.model.data@1233c96, com.pack.web.model.data@5ec471]. need store list file json format. how can this.
you have override tostring() of object. use below or change according requirement.
@entity @table(name="tbl_genere") public class data implements serializable{ private static final long serialversionuid = 1l; @id @column(name="dataid") private string dataid; @column(name="dataname") private string dataname; public string getdataid() { return dataid; } public void setdataid(string dataid) { dataid = dataid; } public string getdataname() { return dataname; } public void setdataname(string dataname) { dataname = dataname; } public string tostring(){ return dataid+","+dataname; } }
Comments
Post a Comment