This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes unexpected token: group Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply locked New topic
Author

unexpected token: group

diana yusof
Greenhorn

Joined: Mar 04, 2008
Posts: 2
Could anybody answer me how to make this code run.

String sql = "select MONTH(CC.createddateTs) as months , "+

"(SELECT COUNT(CC1.communicationtypeTx) from Customercommunication as CC1 "+
" where CC1.communicationtypeTx = 'Complaint' and MONTH(CC1.createddateTs)= MONTH(CC.createddateTs) "+
" group by MONTH(CC1.createddateTs) ) as complaint," +

"(SELECT COUNT(CC2.communicationtypeTx) from Customercommunication as CC2 "+
" where CC2.communicationtypeTx = 'Enquiry' and MONTH(CC2.createddateTs)= MONTH(CC.createddateTs) "+
" group by MONTH(CC2.createddateTs) ) as Enquiry "+

"from Customercommunication as CC where YEAR((CC.createddateTs) = 2008 group by MONTH(CC.createddateTs) "+
"order by MONTH(CC.createddateTs) ASC";

Query query = mSession.createQuery(sql);

when i run this code i get this error:
ERROR [org.hibernate.hql.PARSER] - <line 1:698: unexpected token: group>
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41085
    
  43
Please do not post the same question multiple times.

Let's continue the discussion in this duplicate thread, where you have answers already.


Ping & DNS - my free Android networking tools app
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: unexpected token: group
 
Similar Threads
SQL to Hibernate HQL conversion error
Hibernate query help
Please help me to convert this SQL to hibernate query
unexpected token: group
Unexpected Token Problem