首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Exception >

net.sf.hibernate.QueryException: expecting 'elements ' or 'indices ' after: 异常

2014-01-26 
我有两个类Jobmeetingunit(招聘会单位)Stall(招聘会信息)他们的映射文 件如下 Jobmeetingunit.hbm.xml: m

 我有两个类Jobmeetingunit(招聘会单位)Stall(招聘会信息)他们的映射文

件如下
Jobmeetingunit.hbm.xml:
<many-to-one
  name= "stall "
  class= "net.juntian.rc.domain.Stall "
  cascade= "none "
  outer-join= "auto "
  update= "true "
  insert= "true "
  access= "property "
  column= "STALL_ID "
  unique= "true "
  />
----------------------------
Stall.hbm.xml:
<set
  name= "jobmeetingunit "
  lazy= "true "
  inverse= "true "
  cascade= "all "
  sort= "unsorted "
 
  >

  <key
  column= "STALL_ID "
  >
  </key>

  <one-to-many
  class= "net.juntian.rc.domain.Jobmeetingunit "
  />
-----------------------------
然后我其中一段查询代码如下
Stall localejobinfo=null;
localejobinfo=(Stall)session.createQuery( "from Stall as s where

s.jobmeetingunit.enterprisedi=? ")
  .setLong(0,enterid)
  .uniqueResult();
-------------------------------
运行以后的错误提示为:
net.sf.hibernate.QueryException: expecting 'elements ' or 'indices ' after:

enterprisedi [from net.juntian.rc.domain.Stall as s where

s.jobmeetingunit.enterprisedi=?]
请问这是怎么回事?如何修改?
------解决方法--------------------------------------------------------
Stall localejobinfo=null; 
localejobinfo=(Stall)session.createQuery( "from Stall as s where s.jobmeetingunit.enterprisedi=?").setLong(0,enterid).uniqueResult();
不要这样写试试,不要写在一个表达式里面.

        

热点排行