A good question, and the answer is no.
Suppose one performed a query to
select Employees in Sales where Salary > 100000 order by Name
What would you expect findReferencing to return? All employees, or just those
queried?
And how sorted? And what use is an unsorted list?
So instead we make the query explicit
List<Employee> employess = new
SQuery(Employee.EMPLOYEE).eq(Employee.DEPARTMENT, d100q)
This makes the semantics clear, is much more flexible, and is hardly any more
typing. (Hibernate is a mess in this area, because it tries to impose the low
level Object Oriented model of associations on the higher level realational
database.)
You can also query the DataSet for all Employees that are in memory, and then
filter that. It can be used while the DataSet is detached from the database.
Regards,
Anthony
At 09:52 AM 7/07/2009, you wrote:
>How do you feel about having a findReferencing method in SRecordInstance, just
like the existing findReference there?
>
>That'd make it just as easy to lazily fetch the one-to-many as the many-to-one
relationship.
>
>E.g.
>Already:
>Department department = employee.findReference(employee.DEPARTMENT);
>
>Proposing also:
>List<Employee> employess = department.findReferencing(employee.DEPARTMENT);
>
>Thanks,
>Josh
>
>
Spreadsheet Detective,
Southern Cross Software Queensland Pty Limited
54 Gerler Street
Bardon, Queensland 4065, Australia.
Email: berglas@...
www.SpreadsheetDetective.com
Ph: +61 427 830248 (Australian Eastern Standard Time)
"If the model seems correct only because the numbers look right,
then why build the model in the first place?"