It's really necessary, but unfortunately, I didn't manage to get the byte code build-time instrumentation to help either. I currently use non-FK id:s for blobs as a workaround, which sucks.
I think @Lob and FetchType.LAZY is broken.
Hi Stefan and thanks for your answer!
So, creating another table for the blob and referencing it from my Appendix entity is the way to do it right now? That sucks! :-(
Well, I hope they fix it soon...
Thank you anyways!
Using a java.sql.Blob instead of byte array.
Strange, because the docs says you could use both?!
Anyways, problem has vanished :-)
I've got the same problem. But switching to a Blob attribute didn't help:
it is still loading BLOB column in a query!
I played with hibernate.bytecode.use_reflection_optimizer but got the same result.
Another idea was calling hibernate's javassist instrument task during building the application. It affected the exception during deploying:
javax.persistence.PersistenceException: org.hibernate.MappingException: Could no
t determine type for: org.hibernate.bytecode.javassist.FieldHandler, for columns
We're also puzzled by this.
Even with the lazy load and lob annotation a byte array is still eagerly loaded...
I guess you might find some help in the Hibernate forums, because JBoss JPA uses Hibernate as its implementation.