本站首页    管理页面    写新日志    退出

«August 2025»
12
3456789
10111213141516
17181920212223
24252627282930
31


公告

  如果你忍了,欺负你的人将来可能就进监狱了。如果你反击,欺负你的人将来可能就获选十大杰出青年了。

        QQ: 3159671

http://greenboy.javaeye.com/

http://blog.sina.com.cn/u/1278341164 小鸟吹烟


我的分类(专题)

日志更新

最新评论

留言板

链接

Blog信息
blog名称:小鸟吹烟
日志总数:157
评论数量:424
留言数量:-1
访问次数:1252695
建立时间:2006年10月23日




[Hibernate 专区]hibernate报错
心得体会,  软件技术

tone 发表于 2007/1/30 18:01:15

List jobCri= session.createCriteria(JobTransportList.class)   .setProjection( Projections.distinct( Property.forName  (JobTransportList._OrderID)))   .add( Restrictions.and(    Property.forName(JobTransportList._OrderID).isNotEmpty(),   Property.forName(JobTransportList._OrderID).isNotNull()) ) .list(); 因为查询语句中没有使用到OrderID,所以如果使用到isNotEmpty,isNotNull 就会报如下错误,改成   .add(Restrictions.and(Property.forName(JobTransportList._OrderID).ne(new BigDecimal(0)),         Property.forName(JobTransportList._OrderID).isNotNull())) 即没此问题了 org.hibernate.MappingException: Property path [pglms.j2ee.domain.tms.JobTransportList.OrderID] does not reference a collection at org.hibernate.criterion.AbstractEmptinessExpression.getQueryableCollection(AbstractEmptinessExpression.java:61) at org.hibernate.criterion.AbstractEmptinessExpression.toSqlString(AbstractEmptinessExpression.java:40) at org.hibernate.criterion.LogicalExpression.toSqlString(LogicalExpression.java:39) at org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:333) at org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:71) at org.hibernate.loader.criteria.CriteriaLoader.<init>(CriteriaLoader.java:67) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1532) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283) at pglms.j2ee.service.tms.CalControlCostTest.testJob(CalControlCostTest.java:36) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)  


阅读全文(4783) | 回复(0) | 编辑 | 精华
 



发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.047 second(s), page refreshed 144770818 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号