日期:2014-05-20  浏览次数:20697 次

hibernate多表查询
涉及到3张表联查
String selfsql = "SELECT t.id as nid,t.playName as nameid,t.mapId,t.otherPlayName,t.otherMapId,t.time,t2.cityname,t3.playName FROM T_Log_Traffic as t,T_Map_MapInfo as t2,T_User_UserInfo as t3 where t.playName = '"+userId+"' and t.otherMapId = t2.mapId and t3.userId=t.otherPlayName";
需要8个字段,都取出来了,请问是再新建一个持久化类还是分别用原来的3个,具体怎么做,谢谢

------解决方案--------------------
你可以对以上字段在建个javabean,用的时候比较方便,也可不建,如果要显示这些信息,直接用数组的形式读取就好了,