• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

problem in the groupProperty

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Your mother was a hamster and your father was a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic