Google App Engine - When I want to store a byte array as one of the fields of my entity class, do I have to specify it as of type Blob
or ShortBlob
instead of byte[]
?
views:
165answers:
2
+1
A:
I'm pretty sure you have to. You can always convert to Blob/ShortBlob
for storage only and convert it back into a byte[]
immediately after you restore it.
Pace
2010-04-11 03:52:00
And yes, that breaks the "POJO" paradigm of the AppEngine/DataStore. The main advantages of using POJO as datastore model is to reuse the same model classes in other parts of the application. Using Blob induce (another) dependency from your domain to appengine.
lOranger
2010-09-03 09:43:50
+3
A:
If you need to store a Byte array you have two choices:
- com.google.appengine.api.datastore.ShortBlob : short byte string, < 500 bytes
- com.google.appengine.api.datastore.Blob: long byte string (not orderable)
systempuntoout
2010-04-11 19:53:25