First; Sorry for the cranky subject but this forum doesn't allow enough chars in subject to write usefull ones...
Anyway; In Hibernate-4.1.2 (an probably other versions) I noticed that using "referencedColumnName" on a @JoinColumn in a @ManyToOne-association makes the lazy-loaded entity fore a load.
Take this mapping:
Code:
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "created_by", referencedColumnName = "natural_id")
private Person person = null
When mapping it using Person's PK (and hence skipping the referencedColumnName-attribute from the @JoinColumn-annotation) Hibernate correctly doesn't load the association because it's declared LAZY, but mapping it using an alternate key (here "natural_id") makes Hibernate trigger a load of the lazy-loaded association.
Any way around this?
Thanks.
--
Andreas