Talk User traversal object cast on it. . But my strong turn error. . Is my User and other entities associated with the reasons for it ? Seeking advice. . User and departments Department, Role role has an associated . .
List
long this kind [ [100, a, wl, 81dc9bdb52d04dc20036dbd8313ed055, female , null, null, null, null], [101, b, admin, 21232f297a57a5a743894a0e4a801fc3, male , null, null, null, null], [102, c, li, 81dc9bdb52d04dc20036dbd8313ed055, male, 12113131 , 1 ] , null, null, null, null, null, null, null ] ------ Solution ----------------------------------- --------- not tried this , the top ! ------ Solution ---------------------------------------- ---- However, from the point of view you data transfer is certainly not strong , you should write code to turn . ------ Solution ---------------------------------------- ---- List your User should also be an array of bars. ------ Solution ---------------------------------------- ---- obviously you List taken out of this List is object [] array of how it could be transformed into the User object . List should start removing object [], then traverse object [] array, object [] array object into a User object . ------ Solution ---------------------------------------- ---- array to monomer is certainly being given ah. ------ Solution ---------------------------------------- ---- landlord , since it is removed object List then there is an array of objects transferred directly into a user object , is clearly wrong. suggested in the database query, the data acquired , directly assembled into a user object and add it to a List instead of generating Object [] and then add to the List. last method returns List . hope useful for you ------ Solution -------------------------------- ------------ obviously you List taken out of this List is object [] array of how it could be transformed into the User object . List should start removing object [], then traverse object [] array, object [] array object into a User object . First we resolve this problem ------ For reference only ----------------------------- ---------- your user class which do not have those attributes. . Maybe ------ For reference only ----------------------------------- ---- User is a physical object. . . Obtained from the database is the Object array. . Object array objects to make User object . . Traversal Object object into another strong user work. for (int i = 0; i Object ob = list.get (i); User user = (User) ob ;/ / such a strong turn unworkable } I may be associated with other entities in the User 's reason User attributes: Long userId; Depratment department; Set roles; String userName; String loginName; ...... ------ For reference only ---------------------------- ----------- Thank you . . Problem has been solved. .
没有评论:
发表评论