Sorry that was maybe a bit cryptic, here's working code (from Cay 3.1.1) as per your imaginary case:

class Company extends _Company
{
   public List<Employee> getEmployees()
   {
ObjRelationship rel = (ObjRelationship) Cayenne.getObjEntity( getObjectContext().newObject( Emloyee.class ) )
               .getAnyRelationship( Cayenne.getObjEntity( this ) )
               .getReverseRelationship();

        return (List<Employee>) readProperty( rel.getName() );
   }
}

- Jurgen

Reply via email to