views:

130

answers:

2

I'm using the Objectify library for interfacing with the app engine datastore.

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[]

How do I fix this?

Do I have to change my User class to have the hashed password be of type ShortBlob?

A: 

I would try with:

  1. Using ShortBlog in your Pojo User class
  2. Converting Byte[] to String using String instead of Byte to store your password
  3. Posting a request to Objectify google group
systempuntoout
+1  A: 

Why don't you retrieve as Blob (or ShortBlob) and then take the byte[] out of that with getBytes()?

JohnIdol
I think OP is having problem on somthing like ofy.get(User.class, user.id).
systempuntoout
looks like OP liked the suggestion! :)
JohnIdol