首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

hibernate多表查询解决办法

2012-01-10 
hibernate多表查询涉及到3张表联查String selfsql SELECT t.id as nid,t.playName as nameid,t.mapId,t

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,用的时候比较方便,也可不建,如果要显示这些信息,直接用数组的形式读取就好了,

热点排行