Hi !
I have an entity like below :
@Table(name = "t_gti_interlocuteur")
public class Interlocuteur extends AbstractEntity{
…
@Column(name = "co_entite_liee", length = 3)
private String codeEntiteLiee;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "id_rcu_entite_liee", referencedColumnName = "id_rcu_tiers", insertable = false, updatable = false, foreignKey = @ForeignKey(name = "none"))
private Tiers tiers;
}
The entity “Interlocuteur” can be joined to entity “Tiers”. There is no foreign key between these entities (eg @ForeignKey(name = “none”) ).
But the join must be done only if attribute “co_entite_liee” of entity “Interlocteur” is equals to ‘TIE’.
How can I define with annotations this restriction ?
Thanks