Hello,
Is it any way in EclipseLink to make OUTER JOIN to Secondary Table?
Use case: There is a main employee table that may or may not have some extra data populated in a related secondary table. If there is data in the secondary table (@SecondaryTable), then I would like my Employee entity to have those fields filled in. If there
isn't data for a given employee in the secondary table, then I would like my Employee entity to have nulls in those fields. Right now, if there's no row in the secondary table for a given employee, I get nothing.
I cannot use OneToOne relation for this case, because mapping is defined directly for one business domain object.
Here's example code:
@Entity @Table("EMPLOYEE") @SecondaryTable("EMPLOYEE_EXTRA", pkJoinColumns=@PrimaryKeyJoinColumn(name="EMPLOYEE_KEY"))
public class Employee implements java.io.Serializable {
private static final long serialVersionUID = -3789770304634576481L;
@Column(table="EMPLOYEE_EXTRA", name="EMPLOYEE_EXTRA_DATA",nullable=true) private String employeeExtraData;
@Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="EMPLOYEE_KEY") private Long employeeKey;
...etc
}
Unfortunately I cannot find acceptable solution for it.
Is INNER JOIN for Secondary Table fixed by design?
Regards,
Andrei.