Variable length Blob in hibernate?

Posted by Seth on Stack Overflow See other posts from Stack Overflow or by Seth
Published on 2010-04-19T17:13:12Z Indexed on 2010/04/20 5:13 UTC
Read the original article Hit count: 325

I have a byte[] member in one of my persistable classes. Normally, I'd just annotate it with @Lob and @Column(name="foo", size=). In this particular case, however, the length of the byte[] can vary a lot (from ~10KB all the way up to ~100MB).

If I annotate the column with a size of 128MB, I feel like I'll be wasting a lot of space for the small and mid-sized objects. Is there a variable length blob type I can use? Will hibernate take care of all of this for me behind the scenes without wasting space? What's the best way to go about this?

Thanks!

© Stack Overflow or respective owner

Related posts about java

Related posts about hibernate