我有两个类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();
不要这样写试试,不要写在一个表达式里面.