夏昕的"深入浅出HIBERANTE"有详解.

解决方案 »

  1.   

    看看你的那个 <set name="temp" inverse="true"> 
    name前面是不是有什么包名 有的话要写上 而且在hibernate.hbm.xml中要映射下
      

  2.   

    from temp as t where t.userid="1"
    temp不晓得是不是应该 Temp 还有你的 属性名(userid)应该是同你的实体类的一致。
      

  3.   

    不能直接写 t.userid. 你的temp里面都没有userid的。要这样 from temp as t inner join t.user as u where u.userid="1";
      

  4.   

    问题就是,我是用myeclipse生成的配置文件和pojo。temp里面就没有userid这个属性,只有一个User类的user属性,我就不知道怎么调用表里的userid属性啦!
      

  5.   

    照四楼的做了,还是提示:
    2008-06-09 12:56:22,671 ERROR [org.hibernate.hql.PARSER] - *** ERROR:  inexrecord is not mapped.
    2008-06-09 12:56:22,671 ERROR [org.hibernate.hql.PARSER] - *** ERROR:  Invalid path: 'u.userid'
    2008-06-09 12:56:22,687 ERROR [org.hibernate.hql.PARSER] - *** ERROR: <AST>:0:0: unexpected end of subtree
      

  6.   

    照四楼的做了,还是提示:
    2008-06-09 12:56:22,671 ERROR [org.hibernate.hql.PARSER] - *** ERROR:  temp is not mapped.
    2008-06-09 12:56:22,671 ERROR [org.hibernate.hql.PARSER] - *** ERROR:  Invalid path: 'u.userid'
    2008-06-09 12:56:22,687 ERROR [org.hibernate.hql.PARSER] - *** ERROR: <AST>:0:0: unexpected end of subtree
      

  7.   

    from temp inner join temp.user where temp.user.userid="1"; 这样呢?我很久不写SQL了。我写createCriteria的
      

  8.   

    回复8楼,还是一样的,郁闷啦!!怎么是没映射啊。启动tomcat的时候明明都提示:
    2008-06-09 13:06:33,250 INFO [org.hibernate.cfg.HbmBinder] - Mapping class: com.wital.vo.Temp-> temp
    2008-06-09 13:06:33,359 INFO [org.hibernate.cfg.HbmBinder] - Mapping class: com.wital.vo.User -> user
    2008-06-09 13:06:33,359 INFO [org.hibernate.cfg.HbmBinder] - Mapping collection: com.wital.vo.User.temps ->temp
      

  9.   

    我把hql语句写成:from temp as t User as user where user.userid='"+userid+"' and t.user=user.userid现在不报错没有关联啦,报错:2008-06-09 13:58:49,187 ERROR [org.hibernate.hql.PARSER] - *** ERROR: line 1:38: unexpected token: User这个怎么解决啊??
      

  10.   

    查询语句为:from Temp as t ,User as u where u.userId="1" and t.user=u.userId