Witam,
mam problem z działaniem Lazy property w Hibernate już tłumacze dlaczego uważam, że nie działa:
Mapowanie:
@Entity
@Access(AccessType.PROPERTY)
public class SomeEntity {
private Long id;
private String name;
private String note;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
**@Basic(fetch = FetchType.LAZY)**
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
}
Kod wołający
SomeEntity find = em.getReference(SomeEntity.class, 1L);
System.out.println(find.getName());
System.out.println(find.getNote());
Generuje mi SQL na wszystkie kolumny czyli id,name i note. A spodziewam się, że pójdą 2 sql'e pierwszy bez note a drugi tylko na note. CO robię źle?
Instrumentacja - działa bo jak dekompiluje kod to widze wstawki hibernate
<plugin>
<groupId>org.hibernate.orm.tooling</groupId>
<artifactId>hibernate-enhance-maven-plugin</artifactId>
<executions>
<execution>
<phase>process-test-resources</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>