Dear all,
I ask myself what's the best way to manage lazy-loading + embedded object with a Lob property.
1°) Here's my environment:
- JPA as API
- Hibernate as implémentation with following versions:
hibernate-3.2.4.jar
hibernate-entitmanager-3.3.1.ga.jar
hibernate-annotations-3.3.0.ga.jar
2°) Here's my very simple domain model:
a Personne who embeddes an object of type PersonnePhoto, and this one having a property of type java.sql.Blob.
Code:
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Personne implements Serializable {
...
@Embedded
@Basic(fetch = FetchType.LAZY)
private PersonnePhoto personnePhoto;
}
Code:
@Embeddable
public class PersonnePhoto {
....
@Lob
@Column(name="PABLOB")
private java.sql.Blob photo;
private String name;
}
I thought that i just had to to enable interception on the component property personnePhoto with annotation @Basic(fetch = FetchType.LAZY) but it does not seem to run well, because when i load Person entites, Hibernate loads the lob also.
What is not clear to me is, if it's the correct way to do,
if need or not to instrument the bytecode of my class Personn after compilation.
Thanks for your lights,
Regards.