Okay, whee! So after deciding I should file a ticket for this, I went
to look up posts here on the group to give proper support for a more
concise "here's what needs fixed" description. I found the original
posting that I now notice I obviously misread:
http://groups.google.com/group/play-framework/browse_thread/thread/588a5b1c89b64cd0/85450c4d9a5f10cd#85450c4d9a5f10cd
In this post, the getFile() method is *not* going away, and was in
fact exposed because it would be useful to the end of cleaning up
orphans. So, knowing this, my special table tracking proposal from
above seems to stand as the best way to manage these orphans. Below is
how I believe this could be reasonably implemented.
**What is needed**
* A periodic Job subclass for cleaning up orphans.
* A table for tracking file names of orphans.
**Process**
When an entity is going to be saved or deleted, get a copy of the
entity from the database. Store the file names of the Blobs in that
entity to the tracking table. This must be done in the same
transaction to ensure you do not later clean up files still in use.
The Job then comes along and reads from the tracking table and deletes
the files on disk listed by the table and clears the tracking table.
**Upsides**
Unlike deleting files associated with Blobs when the parent entity is
deleted, you ensure files orphaned by updating a Blob (instead of
deleting the parent entity) are removed. This also doesn't have an
issue where you delete the Blob-associated file, then end up somehow
having the transaction rolling back and that file no longer existing.
**Downsides**
This requires an extra database call every time you want to save an
entity with Blobs.
I hope this helps anyone who finds this in creating a useful clean-up
mechanism.