I'm using spring and hibernate, and have a strange blob problem. I use Xdoclet and map a blob field into the DB with a normal:
mapping, and this generates by blob table field and all is good. I can store normal data in there, and don't have any problems... until I try to store encrypted data.
I have an application that stores normal data in some blobs (text, file data, etc..) and encrypted data in some blobs (the raw encrypted output). The problem is.. when I store the raw encrypted data, it silently fails and stores the data as a totally munged data.
The odd thing.. when I store it, lets say I'm storing a byte array of 208 bytes.. if a select length(blobfield) from the database, it says 208 bytes.. but when I read that blob back in its 104 bytes.
Now.. if I simplify the encoding of the data by, say, Hex encoding it before storing it in the blob... no problem. It stores fine, and retrieves fine.
Now, I use this Blob handler all over my app, and this is the only place I have this problem. Any ideas on what the heck is going on?
By the way, this is with a MySQL 4 database and blob/longblob fields. I'm using an INNODB backend, and Hibernate / Spring's Blob handlers in this application.
Any pointers would be great! Thanks!