How to add a one-to-many association based on two columns where one has a FIXED VALUE

Hello,

@JoinColumnsOrFormula does no fit my requirements as it is not possible to associate the column in the child table.

@JoinColumnsOrFormulas({
	@JoinColumnOrFormula(
		formula = @JoinFormula(
			value = "LU", 
			referencedColumnName = "prefixID"
		)
	),
	@JoinColumnOrFormula(
		column = @JoinColumn(
			name = "fieldID", 
			referencedColumnName = "ID"
		)
	)
})

The sample above raises an error as the referencedColumnName is expected to be in the parent table.

This is the solution that works for me, don’t know if it is the best one.

@Expose	
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumn(name = "fieldID")
@Where(clause = "prefixID = '" + LUDBConfig.LUPrefix + "'")
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
private Set<CustomLabel> customLabels = new HashSet<>();