Hi,
i have the problem that every time i access the id field from a lazy loaded object (@ManyToOne) the whole object is loaded by a select althought this
should not be needed as the id is already loaded with the main object. I found out that hibernate usually doesn't do this when using
property level annotations. As i would like to use field annotations i searched for a solution for this way and found the @AccessType
annotation.
http://256.com/gray/docs/misc/hibernate ... ions.shtmlThis seems to work:
Code:
@Id
@AccessType("property")
private Long pktable;
public Long getPktable() {
return this.pktable;
}
The problem is that i have a second getter for the id (inherited general method for all beans) and everytime i access the id using
this second method hibernate still loads the whole object:
Code:
@Id
@AccessType("property")
private Long pktable;
// works
public Long getPktable() {
return this.pktable;
}
// loads whole object
public Long getId() {
return this.pktable;
}
Is there a way to tell hibernate that this getter also just retrieves the id and a load is not needed?
Thanks a lot!
Yours
Thomas