解决方案 »
- Oracle高手进入帮忙解决个奇怪的问题
- MyEclipse CSS问题
- javamail发邮件问题,为什么只能发本服务的??
- 为什么我的JBoss在cmd命令行下面启动后是其他端口,而在Eclipse下面启动后是8080端口?
- http://localhost:8080/struts1/updateUser.jsp?account=2623422 EL表达式无法取参数
- hibernate 动态构造对象实例问题*********************
- 如何利用property配置spring的xml
- ajax+struts+spring+hibernate的论坛源码下载
- 急,请高手指点 TOMCAT宕机
- 哪儿可以找到可用于SQL SERVER的专业级的数据库连接池 50分相送!
- 利用session对用户是否登录进行过滤的方案
- struts 2 如何在JAVA中实现页面跳转
select * from t1,t2,t3 where t1.t2id = t2.id and t1.t3id = t3.id
这样可行吗?最后用hibernate的对象导航简单
<id name="fwid">
<generator class="uuid"></generator>
</id>
<property name="shi"/>
<property name="ting"/>
<property name="fwxx"/>
<property name="zj"/>
<property name="title"/>
<property name="dates"/>
<property name="telephone"/>
<property name="lxr"/>
<many-to-one name="t2" column="userid" fetch="select"/>
<many-to-one name="t3" column="jdid" fetch="select" />
<many-to-one name="t4" column="lxid" fetch="select"/>
</class>怎么写啊??
这条hql语句不行吧 因为到最后我要把它转换成t1表的类型显示出来 不能转换啊
这条hql语句肯定不行! 因为对象里面哪来的“*”操作符啊!!!
至于使用createSQLQuery 语句确实可以一次性把3个表的数据都查出来 但是我做循环的时候只能转换成一个表对象吧!!!也就是说只能转换成t1表的值循环 因为t1表里面有t2,t3表的外键!!!!!!
所以要么用导航要么用left join fetch 如果还有别的情分享下..........
在配置文件中使用导航小弟不是很会 所以麻烦各位大侠了............
from t1,t2,t3 where t1.t2id = t2.id and t1.t3id = t3.id
查出来的是一个list,而这个list里比放过 list.get(0)里分别有t1,t2,t3三个对象!
你在遍历的时候直接通过get方法,就能得到t1,t2,t3里面的值