There is a way to bypass the validation and get it to work, thus indicating the column is a "@JoinColumnsOrFormulas" then put the solution:
Error:
@ManyToOne @JoinColumns(value = { @JoinColumn(name = "country_code", referencedColumnName = "country_code"), @JoinColumn(name = "zip_code", referencedColumnName = "code")}) private Zip zip = null; @ManyToOne @JoinColumns(value = { @JoinColumn(name = "country_code", referencedColumnName = "country_code", insertable = false, updatable = false), @JoinColumn(name = "state_code", referencedColumnName = "state_code"), @JoinColumn(name = "city_name", referencedColumnName = "name")}) private City city = null; OK: @ManyToOne @JoinColumns(value = { @JoinColumn(name = "country_code", referencedColumnName = "country_code"), @JoinColumn(name = "zip_code", referencedColumnName = "code")})}) private Zip zip = null;
@ManyToOne @JoinColumnsOrFormulas(value = { @JoinColumnOrFormula( @JoinFormula(value = "country_code", referencedColumnName = "country_code") ), @JoinColumnOrFormula( @JoinColumn(name = "state_code", referencedColumnName = "state_code"), @JoinColumnOrFormula( @JoinColumn(name = "city_name", referencedColumnName = "name") ) }) private City city = null;
Regards,
There is a way to bypass the validation and get it to work, thus indicating the column is a "@JoinColumnsOrFormulas" then put the solution:
Error:
@ManyToOne
@JoinColumns(value = { @JoinColumn(name = "country_code", referencedColumnName = "country_code"), @JoinColumn(name = "zip_code", referencedColumnName = "code")})
private Zip zip = null;
@ManyToOne
@JoinColumns(value = { @JoinColumn(name = "country_code", referencedColumnName = "country_code", insertable = false, updatable = false), @JoinColumn(name = "state_code", referencedColumnName = "state_code"), @JoinColumn(name = "city_name", referencedColumnName = "name")})
private City city = null;
OK:
@ManyToOne
@JoinColumns(value = { @JoinColumn(name = "country_code", referencedColumnName = "country_code"), @JoinColumn(name = "zip_code", referencedColumnName = "code")})})
private Zip zip = null;
@ManyToOne
@JoinColumnsOrFormulas(value = { @JoinColumnOrFormula( @JoinFormula(value = "country_code", referencedColumnName = "country_code") ), @JoinColumnOrFormula( @JoinColumn(name = "state_code", referencedColumnName = "state_code"), @JoinColumnOrFormula( @JoinColumn(name = "city_name", referencedColumnName = "name") ) })
private City city = null;
Regards,