表CreditCardBasicInformation  表CustomerInformation  ,表A 一对多 表B   HQL: FROM CreditCardBasicInformation cr left join cr.customerInformation c
用HQL关系查询时报错: Unknown column 'customerin1_.customerIdentifier' in 'on clause'主要就是关联查询出错,查询时需要用的查询分布在两张表里,
如果不能解决这个问题,可以有什么其他办法扰开么请各位多多指点。

解决方案 »

  1.   

    Unknown column 'customerin1_.customerIdentifier' in 'on clause' customerIdentifie没有这个列啊
      

  2.   

    关联应该在映射文件里用one-to-many,而不是自己写hql来查具体可以参考
    http://blog.csdn.net/wx123456wx/archive/2009/09/11/4542713.aspx写上one-to-many后,查A时,hibernate自动会帮你查B,然后把值填到A的成员变量里的
      

  3.   

    3# :
        我已经有映射one-to-many,也可以拿到数据,但是这样的话查询的条件只能是A表里面的,我要求的查询条件一部分还在B里面,我有想过先拿A,再从A里面筛选B条件,但是感觉这样太慢了
      

  4.   

    2#:
        你所说的列是有的,我用不关联的语句是可以查到数据的
    HQL:from CreditCardBasicInformation cr,CustomerInformation c where c.customerIdentifier='002'
      

  5.   

    这样?
    select * from table t1,table t2 where t1.A_id=t2.A_id
      

  6.   

    7#:
        配置好了双向关联后怎么做?...查询的条件一部分在A表一部分在B表....
    不用关联查询的话就会很麻烦了,HQL有自带的关联查询,但是按照配置出现错误...