| I have instrumented entity class with 2 lazy properties and @ManyToMany lazy association:
@Entity
public class HkvSubclass {
@Lob
@Basic(fetch = FetchType.LAZY)
@Column(name = "CERTIFICATE_1")
private String encodedCertificate1;
@Lob
@Basic(fetch = FetchType.LAZY)
@Column(name = "CERTIFICATE_2")
private String encodedCertificate2;
@ManyToMany(mappedBy = "hkvSubclasses", cascade = CascadeType.ALL)
@Fetch(FetchMode.SUBSELECT)
private List<HkvDocument> hkvDocuments = new ArrayList<>(0);
If I update any lazy property (encodedCertificate1 or encodedCertificate2), Hibernate does not update it to database - it executes UPDATE, but without including the column(s) of updated property. Update occurs only if I initialize all lazy properties: encodedCertificate1, encodedCertificate2 and hkvDocuments. The culprit seems to be in AbstractEntityPersister#update method where it gets SQL update statements from getUpdateStrings() method (and accordingly the property list to use from method getPropertyUpdateability()) based on whether all lazy properties were initialized. |