Beginner |
|
Joined: Thu Jul 22, 2004 4:32 am Posts: 31
|
Can I write count(distinct po.compositeId) in hql?
when I do this, Hibernate reports a error:
net.sf.hibernate.QueryException: path expression ends in a composite value: collection1_.id [ select count(distinct collectionPO.id) from gov.ntcri.domain.po.collection.CollectionCreatorPO as creatorPO join creatorPO.collectionPO as collectionPO where creatorPO.creatorName like '%%'and collectionPO.isDeleted=0] at net.sf.hibernate.hql.PathExpressionParser.getWhereColumn(PathExpressionParser.java:375) at net.sf.hibernate.hql.SelectParser.token(SelectParser.java:160) at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87) at net.sf.hibernate.hql.ClauseParser.end(ClauseParser.java:114) at net.sf.hibernate.hql.PreprocessingParser.end(PreprocessingParser.java:143) at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:30) at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:149) at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:138) at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:293) at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1561) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1532) at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39) at com.dsii.common.hibernate.HibernateUtils.getCount(HibernateUtils.java:297) at gov.ntcri.domain.dao.collection.CollectionDAO.searchByCollectionCreatorName(CollectionDAO.java:301) at gov.ntcri.domain.dao.collection.CollectionDAO.main(CollectionDAO.java:311)
|
|