Looking at EntityFindImpl, I see that GROUP BY clause is added only when
functions are used. I am not able to understand it completely. It would be
great if an example usage of "group by" using entity api is shared.
Thanks
Vasanth
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Actually, I am trying to port the following mysql query, using entity api.
SELECT GROUP_CONCAT(COLUMNA), GROUP_CONCAT(COLUMNB), COLUMNC, COUNT(COLUMNC) COUNTC, COLUMND FROM TABLE_A WHERE COLUMNC IN ('X','Y','Z') GROUP BY COLUMND HAVING COUNTC = 3 ORDER BY MIN(COLUMNE);
TableA is already defined as an entity.
Help in porting this into the equivalent EntityFind would be a great help for
me.
Thanks,
Vasanth
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
For very custom/complex queries, and in general for queries you can't do with
the normal Entity Facade API (ie EntityFind, EntityList, etc) you can use the
EntityFacade.getConnection(groupName) method.
If the result columns match an entity or view entity you can also run custom
SQL queries and get a EntityListIterator object back (instead of a plain JDBC
ResultSet) using the EntityFacade.sqlFind(String sql, List<Object>
sqlParameterList, String entityName, List<String> fieldList) method.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Looking at EntityFindImpl, I see that GROUP BY clause is added only when
functions are used. I am not able to understand it completely. It would be
great if an example usage of "group by" using entity api is shared.
Thanks
Vasanth
Actually, I am trying to port the following mysql query, using entity api.
TableA is already defined as an entity.
Help in porting this into the equivalent EntityFind would be a great help for
me.
Thanks,
Vasanth
For very custom/complex queries, and in general for queries you can't do with
the normal Entity Facade API (ie EntityFind, EntityList, etc) you can use the
EntityFacade.getConnection(groupName) method.
If the result columns match an entity or view entity you can also run custom
SQL queries and get a EntityListIterator object back (instead of a plain JDBC
ResultSet) using the EntityFacade.sqlFind(String sql, List<Object>
sqlParameterList, String entityName, List<String> fieldList) method.