After adding java.sql.Blob field to one of my objects the hibernate persistence manager is now throwing Blobs are not cacheable exception.

Any idea how to solve this other than disabling the cache. I tried making the field transient but of course with no success.

BTW I use the latest Spring Framework.

share|improve this question

Can you provide more details? Exception? DB? Have you tried turning off caching? – James DW Oct 14 '11 at 15:17
feedback

1 Answer

up vote 3 down vote accepted

You have 2 choices.

  1. if you don't need the relevant blob data cached, move it into a secondary hibernate object which is not cached
  2. if you do want the data cached (in which case i would assume it has a limited size), then you can use the hibernate type which maps the data to/from a byte[] ("binary" i believe) - http://www.mkyong.com/hibernate/hibernate-save-image-into-database/
share|improve this answer
@MattBanik - if you go the binary route, just make sure someone doesn't try to save a 2GB image. – jtahlborn Oct 14 '11 at 15:49
feedback

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.