It's a very painful problem.
Scene, Hibernate reads data
@Override public list<object> getranklist (date stime, date etime, int type, int num) { String hql = "sel ECT p.content, SUM (p.count) from Profilejudgecount P " +" where P.type =: Type and p.date between:stime and:etime " + "GROUP by p.content Order by sum (p.count) desc limit 0," + num; Return Sessionfactory.getcurrentsession (). CreateQuery (HQL). Setinteger ("type", type). setDate ("Stime", stime). SetDate ("ETime", etime). List (); }
Returned is a list of obj ect, the phenomenon of debuggingin Eclipse Environment
Figure one: Directly view the returned List object L, shown below
Figure Two: Click on a specific element, shown below, to see what's inside, a string, a value,
Figure three: Trace view element specific content, is the number of groups, the first element is a string, the second element is a long integer
Positive three, ToString function, get [ljava.lang.object;@9654f70 similar content
Try to convert the elements, using the GetClass function to find that the type is Java.lang.Object, which can only be cast so that the contents are removed
1: Custom entity, entity attribute a string, a long integer, conversion exception
2: Found similar to a jsonarray, conversion exception
3: Convert string[], convert exception
4: Convert list, convert exception
5: Convert serializable, get byte array, turn to string, can see Chinese, but there is garbled
Final conversion object[], success, wish, exhausted
Thoroughbred Object Cast