@ManyToOne @JoinColumn(name="company_name", referencedColumnName="co_name") private Company company;
Normally the "referencedColumnName" is expected to be a primary key column.
This is a change to allow a non-primary key column to be used instead.
NOTE: This is NOT A RECOMMENDED APPROACH - but if you are dealing with a schema that has such a design you may need this.
List<Something> list = Ebean.find(Something.class) .fetch("company") .findList();
Results in:
select s.id c0, s.some c1 , sc.comp_id c2, sc.co_name c3 from something s left outer join company sc on sc.co_name = s.company_name
Code changed in head to allow this.
Will deploy in snapshot and get Rien to confirm that it works as expected.
Uploading: http://www.avaje.org/archiva/repository/snapshots/org/avaje/ebean/2.6.0-SNAPSHOT/ebean-2.6.0-20100331.044526-1.jar