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条)

报告相同问题?

悬赏问题

  • ¥20 iqoo11 如何下载安装工程模式
  • ¥15 本题的答案是不是有问题
  • ¥15 关于#r语言#的问题:(svydesign)为什么在一个大的数据集中抽取了一个小数据集
  • ¥15 C++使用Gunplot
  • ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?
  • ¥15 matlab数字图像处理频率域滤波
  • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
  • ¥15 ELGamal和paillier计算效率谁快?
  • ¥15 蓝桥杯单片机第十三届第一场,整点继电器吸合,5s后断开出现了问题
  • ¥15 file converter 转换格式失败 报错 Error marking filters as finished,如何解决?