as titled.
The value-based property could be lazily loaded with the following code after I ran InstrumentTask to do the bytecode instrument:
Code:
@NotEmpty
@Length(max = 100)
@Column(columnDefinition = "nvarchar(100)")
@Basic(fetch=FetchType.LAZY)
public String getName() {
return name;
}
But the component couldn't:
Code:
@Embedded
@Basic(fetch=FetchType.LAZY)
public Attachment getAttachment() {
return attachment;
}
What i want to do is to load the byte[] lazily, and the Attachment contains the byte[]. And i do another try, to lazily load the byte[] directly. But it doesn't work either.
Code:
@Embeddable
public class AttachmentContent extends PersistentBean implements Serializable {
private byte[] content;
@Lob
@Basic(fetch=FetchType.LAZY)
public byte[] getContent() {
return content;
}
But when i move the byte[] to the owning entity, it works. So i think my problem is "how to lazily load a compoent or properties in the compoent?"