google-code-export / objectify-appengine

Automatically exported from code.google.com/p/objectify-appengine
MIT License
1 stars 0 forks source link

Loading object with byte[] causes error. #31

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm using the Objectify 2.1.

In my User class, I store the hashed password as a byte[].  When I put it in 
the datastore, it is correctly stored as a blob.

When I try to load the User object back out I get this error:

java.lang.IllegalStateException: Cannot load non-collection value '<Blob: 40 
bytes>' into private byte[]

Is this a problem with how I have things set up, or a problem with Objectify?  
Anyone know how I could fix this?

Original issue reported on code.google.com by kwste...@gmail.com on 11 Apr 2010 at 3:07

GoogleCodeExporter commented 9 years ago
Am I supposed to specify the hashed password field as 
com.google.appengine.api.datastore.ShortBlob instead of byte[]?

Original comment by kwste...@gmail.com on 11 Apr 2010 at 3:18

GoogleCodeExporter commented 9 years ago
This sounds like a bug.  If Scott or Matt doesn't get to it before then, I will 
look into it when I get back to town 
tomorrow.

Original comment by lhori...@gmail.com on 11 Apr 2010 at 5:29

GoogleCodeExporter commented 9 years ago
I'm pretty sure I was using Byte[] in my code at some point and it worked fine. 
You 
might try that till we can take a look, or get a fix.

Original comment by scotthernandez on 11 Apr 2010 at 5:43

GoogleCodeExporter commented 9 years ago
Warning:  Byte[] does *not* get encoded as Blob.  Byte[] will be encoded in the 
datastore as an indexable array of 
Byte objects (which in fact become Longs).

Only byte[] undergoes the special conversion to and from Blob.  This needs a 
unit test.

Original comment by lhori...@gmail.com on 11 Apr 2010 at 6:04

GoogleCodeExporter commented 9 years ago
I ran into this bug as well. I just manually wrapped the byte[] in a 
com.google.appengine.api.datastore.Blob.

Original comment by lukelast@gmail.com on 12 Apr 2010 at 8:30

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r504.

Original comment by lhori...@gmail.com on 12 Apr 2010 at 11:49