Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storing large blob with Objectify Appengine

I have this class which I want to persist using Objectify, this class will represent a data larger than 1MB so there's a List of Blob objects which represents a fragment of the byte array stored that is less than 1MB in size:

@Entity
public class BigBlob {

    @Id
    private Long id;
    public static final int FRAGMENT_LIMIT = 777 * 1024;
    @Serialized
    private List<Blob> fragments = new ArrayList<Blob>();

    ...

}

Yet, the the "fragments" is @Serialized, which will render the size of this BigBlob class/object larger than 1MB.

Causing this error:

com.google.apphosting.api.ApiProxy$RequestTooLargeException: The request to API call datastore_v3.Put() was too large.

If I use @Embedded annotation I get this error:

Cannot place array or collection properties inside @Embedded arrays or collections

How do I make sure that the "fragments" are stored as a separate entity?

BTW, I already have the byte chunking logic that chops the whole byte array and put the fragments into a List of Blob so this question does not pertain as to how to chop bytes.

Mostly what I want to know is more on the persisting side.

like image 446
quarks Avatar asked May 21 '12 17:05

quarks


1 Answers

You should store it in the Blobstore and just save the Blobkey in Objectify. Objectify works on top of the datastore, not the blobstore.

like image 160
Rick Mangi Avatar answered Sep 27 '22 16:09

Rick Mangi