[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-users] Please help with @ManyToOne - left outer join
|
Hello,
I have another question. I have @ManyToOne relationship (partial implementation)
@Table....
class Company {
@Id
@Column(name = "COMPANY", nullable = false)
private idCompany;
@JoinColumn(name = "ID_EMP", referencedColumnName = "ID_EMP")
@ManyToOne
@JoinFetch(value = JoinFetchType.OUTER)
private Employee employee;
...
}
@Table...
class Employee {
@Id
@GeneratedValue(strategy = GenerationType.TABLE, generator = "SEQ_EMP")
@Basic(optional = false)
@Column(name = "ID_EMP", nullable = false)
private int idEmp;
@Column(name = "AGE")
private double age;
....
}
I want to execute "select object(o) from Company as o order by o.employee.age asc". But the result doesn't return Companies with Company.employee = NULL. It has where condition with "=" not with outer join.
Please can you help me what I'm doing wrong. Platform: Derby 10.5.3.0, EclipseLink 1.1.3. Is it necessary to use EclipseLink 2.0.1? Or my definition is wrong. I tried to look in tests for eclipselink but I don't se any solution.
I need tell EclipseLink to use Left Outer Join for querying "employee".
I tried redefine mapping in DescriptorCustomizer for "Company" without success.
OneToOneMapping m = (OneToOneMapping) descriptor.getMappingForAttributeName("employee");
m.dontUseIndirection();
m.useOuterJoinFetch();
Thank you
Martin