Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Please help with @ManyToOne - left outer join


  I have another question. I have @ManyToOne relationship (partial implementation)

class Company {

  @Column(name = "COMPANY", nullable = false)
  private idCompany;

    @JoinColumn(name = "ID_EMP", referencedColumnName = "ID_EMP")
    @JoinFetch(value = JoinFetchType.OUTER)
  private Employee employee;


class Employee {
  @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, 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");

 Thank you

Back to the top