我要查询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]
知道什么原因了..两个表有相同的字段复合查询的时候把他给省略了
都已经是sql了,看你写的sql是怎么样的,用sql了很大可能就是得自己封装实体了
少了“,"号,还有,建议最好加上select xxx
from CustTEntity c[color=red] , [/color]SeleCustTEntity s where c.custId=s.custId and c.comingflag=1
select c.*,s.* from CustTEntity c left join SeleCustTEntity s on c.custId=s.custId where c.comingflag=1
两个实体没关联的话,就不用用hql语句来写
改成sql就ok了
调用别人的工具类,那没有提供得到session的方式吗
有的话就好办啊
getSession().[color=red]createSQLQuery/color.list();就ok了嘛