4 Replies Latest reply on Jun 3, 2008 10:22 PM by Siarhei Dudzin

    How to use EntityQuery and aggregating functions for lists

    keith bannister Newbie

      Hi,


      I'm pretty new to EJB/Seam and things have been going great so far but I've run in to a snag.


      I have 2 Entities, A RadioSource and a FieldSource. One RadioSource owns many FieldSources. FieldSources have an attribute called flux (a double).


      I want to display a table of RadioSources - I want the following columns in the table:


      - RadioSource ID and other stuff (I think I know how to do this)
      - Maximum/Minimum/Average flux of all the FieldSources owned by this RadioSource. All separate columns with the nifty click and the list is re-ordered feature.
      - The value of (Maximum - minimum)/Average flux as another column with the sorting feature
      - A link to the FieldSource whose flux was the minimum/maximum


      The only SEAM stuff I've managed to do so far is basic CRUD s and to create some plots with jfreechart.


      I have some java classes which do the statistics as a @Transient class but I can't sort on them because the EJBQL doesn't know they exist (beacause they're @Transient).


      Any ideas?