Hi,
Because I have a legacy database I was trying to make an associations between 2 classses whithout using the Pk on the linked class, something like that:
Code:
class Foo
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="BAR_TYPE_NAME",referencedColumnName="TYPE_NAME",unique=true)
public Bar getBar()
and
Class Bar
...
@Column(name = "TYPE_NAME",unique=true)
public String getTypeName()...
This works however the lazy option has no effect and bar is always fetched in a secondary select.
Is there a way to lazy fetch Bar in this case and to get it cached, given the fact that typeName is unique?
Thanks in advance,
Moor