In hibernate is is possible to map the same column with 2 properties of the same class, and have the possibility to reference both in queries?
Is sounds pointless but it would be worth for what I have to do.
In the underying example I could mark the second getter @Transient to keep the second getter, but I would lose the alias in queries, so I would like to keep both “myPropertyAliasOne” and “myPropertyAliasTwo”.
@Entity
public MyEntity {
private String myProperty;
@Column(name="ACTUAL_VALUE")
public String getMyPropertyAliasOne(){
return myProperty;
}
@Transient
public String getMyPropertyAliasTwo(){
return myProperty;
}
}
If you want to have one column be mapped to two properties, why don’t you just map one of them and set the other with the value of the first.
In this case, you manually have these properties always the same. (but I don’t get it, why this redundancy is useful?)