Hello,
I've posted this to the JBoss forum as well without any luck.
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3973536#3973536.
I'm using JBoss 4.0.4 GA with EJB3.0 RC6 and I'm having problem with a byte array property not being lazy loaded even though it's annotated for lazy loading.
My entity bean is loaded using a EJB-QL statement and the byte array gets loaded even though it's not accessed.
Does anyone know how to fix this? Is it a bug in Hibernate?
My entity bean property is annotated like this:
Code:
@Lob
@Basic(fetch = FetchType.LAZY)
@Column(name = "DOCUMENT", nullable = true)
public byte[] getDocument() {
return this.document;
}
I'm using the following code to load the entity "Appendix" which have the byte array property.
Code:
// Create traffic type query
final EntityManager theEntityManager = this.getEntityManager();
final Query theTrafficTypeQuery = theEntityManager.createQuery("from Appendix a where a.trafficType = :trafficType");
theTrafficTypeQuery.setParameter("trafficType", theTrafficType);
final List<Appendix> theAppendixes = theTrafficTypeQuery.getResultList();
And the following SQL is produced:
Code:
select appendix0_.APPENDIX_ID as APPENDIX1_0_, appendix0_.START_DATE as START2_0_, appendix0_.DESCRI
PTION as DESCRIPT3_0_,
[b]appendix0_.DOCUMENT as DOCUMENT0_[/b]
, appendix0_.EXTENSION_ID as EXTENSION9_0_, appendix0_.CREATE_DATE as CREATE5_0_, appendix0_.PAGE_ID
as PAGE6_0_, appendix0_.PRODUCT_ID as PRODUCT7_0_, appendix0_.STOP_DATE as STOP8_0_ from APPENDIX a
ppendix0_ where appendix0_.PRODUCT_ID=?
Where the bold part of the query is the byte array property being loaded, but it shouldn't.
Please help me, I'm desperate!!!
Regards, Andreas