 <h2>Solution</h2> <h3>Here is the working solution I ended up with:</h3> <pre><code>@Nonnull protected Class&lt;T&gt; getEntityType() { (Class&lt;T&gt;) new TypeToken&lt;T&gt;(getClass()) {}.getRawType(); } /** * purge ObjectMetadata records that don't have matching Objects in the GCS anymore. */ public void purgeOrphans() { ofy().transact(new Work&lt;VoidWork&gt;() { @Override public VoidWork run() { try { for (final T bm : ofy().load().type(ObjectMetadataEntityService.this.getEntityType()).iterable()) { final GcsFileMetadata md = GCS_SERVICE.getMetadata(bm.getFilename()); if (md == null) { ofy().delete().entity(bm); } } } catch (IOException e) { L.error(e.getMessage()); } return null; } }); } </code></pre>