Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Firstly related to Objectify did you take a look at the <a href="http://code.google.com/p/objectify-appengine/wiki/BestPractices" rel="nofollow">Objectify Best practices</a>. As it seems they might present more straightforward approach.</p> <p>Instead of using the ObjectifyService static ofy() method, use your own. </p> <pre><code>public class OfyService { static { factory().register(Thing.class); factory().register(OtherThing.class); ...etc } public static Objectify ofy() { return ObjectifyService.ofy(); } public static ObjectifyFactory factory() { return ObjectifyService.factory(); } } </code></pre> <p>Now in your code, import your own static ofy(): </p> <pre><code>import static com.yourcode.OfyService.ofy; Thing th = ofy().load().type(Thing).id(123L).now(); </code></pre> <p>In this way entity registrations are made once only and always before you require them.</p> <p>With regards to startup performance it depends on the instance class and complexity of entities used. Generally even on the lowest instance class up to around 20 entity types will be possible in under a second. Most likely only if you have hundreds of entity types another approach might make sense investigating.</p> <p>With regards to Guice. It's not obvious how it relates to the provided code, but I would suggest a couple of things:</p> <ul> <li>Generally you'll cause yourself a DI headache if you inject your Entity classes, so most likely you'll want to avoid doing that or using a factory from the entity if you really must get injected classes.</li> <li>As for data controllers, or a UserService (not in your current form) etc. They would generally make reasonable candidates to inject dependencies into or use as injected dependencies.</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload