Hey guys
I am dealing with legacy data and legacy code, thus I really can't change stuff outside of new development.
Is there any way to specific substitute values for join columns? Lets say I don't have a look up table but I have hard coded constants instead.
Like type 1,2 and 3 (which are getters that return a constant)
I want to join on the getters as opposed to a database column
For example
I have the following attribute
Code:
@ManyToOne(cascade={CascadeType.REFRESH, CascadeType.PERSIST},targetEntity=MyClass.class)
@JoinColumns (
{
@JoinColumn (name="FK1", referencedColumnName="PK1", insertable=false,updatable=false,nullable=true),
@JoinColumn (name="FK2", referencedColumnName="PK2", insertable=false,updatable=false,nullable=true)
}
)
public MyValueType getAssociatedValue() {
return associatedValue;
}
to something like (I know that JoinGetter or referencedGetterName does not exists but just want to make an example of what I am looking for).
Code:
@ManyToOne(cascade={CascadeType.REFRESH, CascadeType.PERSIST},targetEntity=MyClass.class)
@JoinColumns (
{
@JoinColumn (name="FK1", referencedColumnName="PK1", insertable=false,updatable=false,nullable=true),
@JoinGetter (name="value", referencedGetterName="PK2", insertable=false,updatable=false,nullable=true)
}
)
public MyValueType getAssociatedValue() {
return associatedValue;
}
Is there something like this? Or do I have to get down to the HQL level myself?
thanks for any input.