yasonisme 2009-04-29 09:38
浏览 309
已采纳

HQL多表查询问题

我要查询2个表..两个表的主键相同 但在数据库中没关联 我写的是
from CustTEntity c left outer join SeleCustTEntity s on c.custId=s.custId where c.comingflag=1

好象这样外连接不行 提示on不对

我直接写成
from CustTEntity c SeleCustTEntity s where c.custId=s.custId and c.comingflag=1
报java.lang.NoSuchMethodError

求解
[b]问题补充:[/b]
还是不行 用select c.*,s.* from CustTEntity c ,com.itm.entity.SaleCustTEntity s where c.custId=s.custId and c.comingflag=1
报的错是 是不是2个实体之间没关联的原因
com.itm.entity.SaleCustTEntity is not mapped [select count(*) from com.itm.entity.CustTEntity c ,com.itm.entity.SaleCustTEntity s where c.custId=s.custId and c.comingflag=1]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: com.itm.entity.SaleCustTEntity is not mapped [select count(*) from com.itm.entity.CustTEntity c ,com.itm.entity.SaleCustTEntity s where c.custId=s.custId and c.comingflag=1]
[b]问题补充:[/b]
用这个查询select c.*,s.* from CustTEntity c left join com.itm.entity.SaleCustTEntity s on c.custId=s.custId where c.comingflag=1

还是NoSuchMethodError
[b]问题补充:[/b]
用sql就麻烦了..调的是别人的工具类
[b]问题补充:[/b]
这个查处来的list的里面是什么?
一个一个的字段?
在往实体里加..
[b]问题补充:[/b]
StatementCallback; bad SQL grammar [select * from (select t.*,rownum as rowno from (select c.*,s.* from a_cust_baseinfo c ,a_cust_coming s where c.custId=s.custId and c.comingflag='1' order by c.contactTel desc ) t)where rowno>='1' and rowno<='10']; nested exception is java.sql.SQLException: ORA-00918: 未明确定义列

看看这个错误
[b]问题补充:[/b]
知道什么原因了..两个表有相同的字段复合查询的时候把他给省略了

  • 写回答

5条回答 默认 最新

  • wanghaolovezlq 2009-04-29 10:32
    关注

    都已经是sql了,看你写的sql是怎么样的,用sql了很大可能就是得自己封装实体了

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建