• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in the groupProperty

 
varsha rao
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI all,

I am trying to write the following query in hibernate

select * from TABLE where txn_id in (select max(txn_id) from TABLE group by
reference_id)

the corresponding criteria i have written is as follows

Criteria searchFormatCodes = session.createCriteria(B2bFormatsummaryTxn.class);

searchFormatCodes.add(Expression.eq("userId", userId));

DetachedCriteria dc = DetachedCriteria.forClass(B2bFormatsummaryTxn.class);
dc.setProjection(Projections.projectionList().add(Projections.max("comp_id.txnId")).add(Projections.groupProperty("comp_id.referenceId")));

searchFormatCodes.add(Subqueries.propertyIn("comp_id.txnId", dc));


but when i try to execute it i get the following error


Caused by: java.sql.SQLException: ORA-00913: too many values


How do i do the correct grouping using criteria's
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic