Search the web
Sign In
New User? Sign Up
SimpleORM
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
findReferencing?   Message List  
Reply | Forward Message #1777 of 1847 |
Re: [SimpleORM] findReferencing?

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?"


Tue Jul 7, 2009 12:39 am

berglas@...
Send Email Send Email

Attachment
1cb896e8.jpg
Type:
image/jpeg
Forward
Message #1777 of 1847 |
Expand Messages Author Sort by Date

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...
spoerrij
Offline Send Email
Jul 6, 2009
11:54 pm

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...
berglas@...
Send Email
Jul 7, 2009
12:45 am

OK. Should we then widen the SSessionI interface? It's nice to be able to write fully testable code that doesn't depend on the concrete SSessionJdbc. But you...
spoerrij
Offline Send Email
Jul 7, 2009
3:21 am

I haven't bothered putting abstract classes on things like SSessionJdbc because I'm not sure that it is useful. Mocking out the database essentially mocks out...
berglas@...
Send Email
Jul 7, 2009
6:08 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help