| Hello, I have a table GD_CODE with 2 columns (PrimaryKey) GD_CODEID GD_CODETYPE For this table a have a class GenericCode This table is referenced from other clases per example in this way TABLE A GD_CODEID class A { @ManyToOne @JoinColumsOrFormulas(@JoinColumnOrFormula(column = @JoinColumn(name = "GD_CODEID", referenceColumnName = "GD_CODEID")), @JoinColumnOrFormula(formula = @JoinFormula(referenceColumnName = "GD:CODTYPE", value = "'A_TYPE'")} ) private GenericCode myCode; } All is fine but if in some records for A the GD_CODEID is NULL when querying for the A class a unnecessary SELECT is done to retrieve the GenericCode, that is not neccessary as the GD_CODEID is NULL so won't be a relation. This is performance problem when there are too many record in A that have GD_CODEID as NULL Is there anyway to avoid this unncessary SELECTS ? Thank you! |