On Wed, May 7, 2014 at 9:36 AM, Erik Jan de Wit <edewit(a)redhat.com> wrote:
Hi all,
As we are working on implementing the new visual design for the console we
ran into something. Right now when you fetch a PushApplication from the
rest service everything is eager fetched including all variants for that
application but also all installations for all these variants.
yes - that is odd, and should be changed; all of the eager things (I think
I added a TODO on these collections)
Now in the old console these installations where only used to list the
number of installations on the ‘application details’ page next to the
variant, for the new console I’ve introduced a count ‘call’ to do the same
so we no longer need this eager fetch.
cool!
This count query is a bit hard as we have separated the association of the
variants per type so in order to have a count of the number of
installations we have to do x queries where ( x is the number of device
types)
Example:
"select v.variantID, count(*) from PushApplication pa join pa.androidVariants v join
v.installations i "
+ "where pushApplicationID = :pushApplicationID and i.enabled = true
"
+ "group by v.variantID";
This query will give the total number of installations for each variant,
but only for android. So what I would like to suggest it to simplify the
data model and only have a relation with variants instead of one per type
this will also make the data model more extendable (when a new device type
is introduced the data model doesn’t have to change). If grouping of these
variants is needed clients will need to do it themselves.
that would still allow us to say "Android-free variant has 10000
installations; iPad variant has 5000 installations", right ?
-M
WDYT
Erik Jan
_______________________________________________
aerogear-dev mailing list
aerogear-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev
--
Matthias Wessendorf
blog:
http://matthiaswessendorf.wordpress.com/
sessions:
http://www.slideshare.net/mwessendorf
twitter:
http://twitter.com/mwessendorf