<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 7, 2014 at 9:36 AM, Erik Jan de Wit <span dir="ltr">&lt;<a href="mailto:edewit@redhat.com" target="_blank">edewit@redhat.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi all,<div><br></div><div>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.</div>
</div></blockquote><div><br></div><div><br></div><div>yes - that is odd, and should be changed; all of the eager things (I think I added a TODO on these collections)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><br></div><div>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.</div>
</div></blockquote><div><br></div><div>cool!</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>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)</div>
<div><br></div><div>Example:</div><div><br></div><div><pre style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;margin-top:0px;margin-bottom:0px;line-height:16.799999237060547px;width:744px;padding:0px;color:rgb(51,51,51);background-color:rgb(255,255,255)">
<div><span style="color:rgb(221,17,68)">&quot;select v.variantID, count(*) from PushApplication pa join pa.androidVariants v join v.installations i &quot;</span></div><div>                <span style="font-weight:bold">+</span> <span style="color:rgb(221,17,68)">&quot;where pushApplicationID = :pushApplicationID and i.enabled = true &quot;</span></div>
<div>                <span style="font-weight:bold">+</span> <span style="color:rgb(221,17,68)">&quot;group by v.variantID&quot;</span><span style="font-weight:bold">;</span></div></pre><div><br></div></div><div>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.</div>
</div></blockquote><div><br></div><div>that would still allow us to say &quot;Android-free variant has 10000 installations; iPad variant has 5000 installations&quot;, right ? </div><div><br></div><div>-M</div><div><br></div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>WDYT</div><span class="HOEnZb"><font color="#888888"><div>
<span style="white-space:pre-wrap">        </span>Erik Jan</div></font></span></div><br>_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Matthias Wessendorf<br>
<br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
</div></div>