Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Jira plugins development: Group by clause in Active objects interface

NazarB July 9, 2013
Hi, Intro: I am using active objects interface for saving my data. I would like to perform a query with group clause : select ev.key, count(ev.key) from events as ev group by ev.key. But seems that i am unable to perform such query, because I can't use aggregate functions in the net.java.ao.Query api. Also it is seemed that i couldn't use findWithSQL method also, because it has the following typization : <t extends="" rawentity<k="">, K>. As far as i understood this that i am able to perform quering on the fields which have the same type as my primary key - K. What would you suggest me? How to execute agregating functions on active objects interface?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
NazarB July 10, 2013
I managed the issue by using plain old JDBC: SQLProcessor sqlProcessor= new org.ofbiz.core.entity.jdbc.SQLProcessor("defaultDS"); String query = "select TYPE, count(TYPE) from AO_175067_SSS_EVENTS group by TYPE"; ResultSet rs=sqlProcessor.executeQuery(query); while ( rs.next() ) { // Process the row. } Also this post was useful for understanding table naming conventions: https://developer.atlassian.com/display/DOCS/Table+names
TAGS
AUG Leaders

Atlassian Community Events