求助:hibernate 联合主键删除

联合主键的类能否用hql删除?

[color=red]为什么 HQL: delete CarDmMenuUser u where u.id.czryDm = ? 报

org.springframework.orm.hibernate3.HibernateQueryException: unexpected token: u near line 1, column 22 [delete CarDmMenuUser u where u.id.czryDm = ?]; nested exception is org.hibernate.hql.ast.QuerySyntaxError: unexpected token: u near line 1, column 22 [delete CarDmMenuUser u where u.id.czryDm = ?]
org.hibernate.hql.ast.QuerySyntaxError: unexpected token: u near line 1, column 22 [delete CarDmMenuUser u where u.id.czryDm = ?]
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:63)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:215)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:127)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:884)
at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:865)
at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:89)
at com.cargis.web.dao.imp.DmMenuDaoImp$1.doInHibernate(DmMenuDaoImp.java:42)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:366)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:334)
at com.cargis.web.dao.imp.DmMenuDaoImp.deleteMenuByUser(DmMenuDaoImp.java:37)
at com.cargis.web.service.imp.CompanyServiceImp.deleteCompany(CompanyServiceImp.java:191)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:165)
at $Proxy1.deleteCompany(Unknown Source)
at com.cargis.web.test.CompanyServiceTest.main(CompanyServiceTest.java:38)
Caused by: line 1:22: unexpected token: u
at org.hibernate.hql.antlr.HqlBaseParser.deleteStatement(HqlBaseParser.java:242)
at org.hibernate.hql.antlr.HqlBaseParser.statement(HqlBaseParser.java:139)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:209)
... 19 more
Exception in thread "main" [/color]

我查了一下,hql基本用不了,是由于由于复合主键的xml定义不同,那么如果要进行复合主键的hql删除应该怎么做呢??

哪位解决一下,万分感谢,急………………
  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 扫一扫,分享海报

©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值