[jboss-user] [EJB/JBoss] - How to use Group By Clause in JBOSS QL?

tiwari_p_k do-not-reply at jboss.com
Mon Sep 11 09:53:52 EDT 2006


Hi,
I am using EJB 2.1 for my application & using JBOSS 4.0.3 as Application server. Now I am using JBOSS Dynamic QL for "group by" clause as follows:-

-------------------------
		   public Collection ejbHomeSelectInStates(Set states)
		   throws FinderException
		   {
		   StringBuffer jbossQl = new StringBuffer();
		   jbossQl.append("SELECT g.orderno ");
		   jbossQl.append("FROM OrderMaster g ");
		   jbossQl.append("GROUP BY g.orderno");
		   Object[] args = states.toArray(new Object[states.size()]);
		   return ejbSelectGeneric(jbossQl.toString(), args);
		   }		   
--------------------------
& I have declared "ejbSelectGeneric" generic method is as follows using XDOCLET:-
--------------------------------------------------
 * @jboss.query
 *    signature="Collection ejbSelectGeneric(java.lang.String ql, java.lang.Object[] params)"
 *    dynamic="true" 
---------------------------------------------------

But when I am accessing function "ejbHomeSelectInStates" in my client, I am getting following error:-
---------------------------------------------
19:02:56,281 INFO  [STDOUT] javax.ejb.FinderException: Error compiling ejbql: org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "GROUP" at line 1, column 36.
Was expecting one of:
     
    "," ...
    
19:02:56,281 INFO  [STDOUT] 	at org.jboss.ejb.plugins.cmp.jdbc.JDBCDynamicQLQuery.execute(JDBCDynamicQLQuery.java:101)
19:02:56,281 INFO  [STDOUT] 	at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCSelectorBridge.execute(JDBCSelectorBridge.java:99)
19:02:56,281 INFO  [STDOUT] 	at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCSelectorBridge.invoke(JDBCSelectorBridge.java:70)
19:02:56,281 INFO  [STDOUT] 	at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke(EntityBridgeInvocationHandler.java:91)
19:02:56,281 INFO  [STDOUT] 	at org.jboss.proxy.compiler.Runtime.invoke(Runtime.java:62)
19:02:56,281 INFO  [STDOUT] 	at econify.ordermaster.ejb.OrderMasterCMP$Proxy.ejbSelectGeneric()
19:02:56,281 INFO  [STDOUT] 	at econify.ordermaster.ejb.OrderMasterBean.ejbHomeSelectInStates(OrderMasterBean.java:288)
19:02:56,281 INFO  [STDOUT] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
19:02:56,281 INFO  [STDOUT] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
19:02:56,281 INFO  [STDOUT] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
----------------------------------------------

I really got bored now as I am trying to solve this problem since last 15 days. Also I searched on net for same, but I am not getting actual solution for it.
PLease help me to solve this problem, as my whole application got stuck due to this.
Thank you.
Pras

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970751#3970751

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3970751



More information about the jboss-user mailing list